Last active
July 13, 2016 08:57
-
-
Save AhmedKamal/4d6949214b0daeecf550b759d5801ab0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public enum PersonEnum { | |
INSTANCE; | |
private int age = 2; | |
public int getAge() { | |
return age; | |
} | |
public void setAge(int newAge) { | |
this.age = newAge; | |
} | |
public static void main(String[] args) { | |
} | |
} | |
class Test { | |
public static void main(String[] args) { | |
PersonEnum personEnum = PersonEnum.INSTANCE; | |
System.out.println(personEnum.getAge()); | |
System.out.println(personEnum.getAge()); | |
personEnum.setAge(10); | |
System.out.println(personEnum.getAge()); | |
personEnum.setAge(11); | |
System.out.println(personEnum.getAge()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment