Hi Te,
I am the absolute newbie to Enum type; I am giving it a try:
> if I can get the subject name to pass to "enum
> passingScore".
public class Work {
public enum Subject {Science, Math, Literature,
History}
enum PassingScore {
Science(50), Math(60), Literature(80),
History(40);
int score;
PassingScore(int myScore) {
score = myScore;
}
int getScore() {
return score;
}
}
public static void main(String[] args) {
Subject theSubject;
PassingScore marks;
theSubject = Subject.Math;
System.out.println("The passing score for "
+ Subject.Math.toString() + " is "
+ PassingScore.Math.getScore());
}
Is that what you meant by passing the subject to PassingScore?
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
-~----------~----~----~----~------~----~------~--~---