Or simpler still:
import java.util.*;
public enum PassingScore {
    Science(55), Math(60),
    Literature(80), History(40);

    private int score;
    PassingScore(int score) {
        this.score = score;
    }
    public int getScore() {
        return score;
    }

    public static void main(String[] args) {
        String subject = PassingScore.Math.name();
        System.out.println("The passing score for "
                + subject + " is "
                + PassingScore.valueOf(subject).getScore());
    }


greenbean

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to