TheBulgarianWolf

Java Enum Example

Jul 26th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1.  class FreshJuice{
  2.     enum FreshJuiceSize{SMALL,MEDIUM,LARGE};
  3.     FreshJuiceSize size;
  4. }
  5.  
  6. public class EnumExample {
  7.  
  8.     public static void main(String[] args) {
  9.        
  10.         FreshJuice juice = new FreshJuice();
  11.         juice.size = FreshJuice.FreshJuiceSize.MEDIUM;
  12.         System.out.println("Size: " + juice.size);
  13.     }
  14.    
  15. }
  16.  
Add Comment
Please, Sign In to add comment