Advertisement
thenewboston

Java Programming Tutorial - 44 - Enumeration

Aug 22nd, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. public class apples {
  2.    public static void main(String[] args){
  3.       for(tuna people: tuna.values())        
  4.          System.out.printf("%s\t%s\t%s\n", people, people.getDesc(), people.getYear());
  5.    }
  6. }
  7.  
  8. public enum tuna {
  9.    bucky("nice", "22"),
  10.    kelsey("cutie", "10"),
  11.    julia("bigmistake", "12");
  12.    
  13.    private final String desc;
  14.    private final String year;
  15.    
  16.    tuna(String description, String birthday){
  17.       desc = description;
  18.       year = birthday;
  19.    }
  20.    
  21.    public String getDesc(){
  22.       return desc;
  23.    }
  24.    
  25.    public String getYear(){
  26.       return year;
  27.    }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement