Created
March 13, 2016 15:19
-
-
Save y0zg/9a5e4c36c70044cec591 to your computer and use it in GitHub Desktop.
static factory methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.db; | |
import java.time.LocalDate; | |
import java.util.Scanner; | |
public class meth { | |
public static void main(String arg[]) { | |
System.out.println("test"); | |
Discount discount=Discount.MinDiscount(); | |
System.out.println(discount.getValue()); | |
} | |
} | |
package com.db; | |
import java.util.Dictionary; | |
/** | |
* Created by webstddesign on 13.03.2016. | |
*/ | |
public class Discount { | |
private int value; | |
private Discount(int value) { | |
this.value=value; | |
} | |
public int getValue(){ | |
return this.value; | |
} | |
public static Discount MinDiscount(){ | |
return new Discount(10); | |
} | |
public static Discount MaxDiscount(){ | |
return new Discount(30); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment