i am reading data from a file, then use the String.split, and get a String[] variable for each line i read.
then i have a class to read the data.
the txt file looks like:
2,John,Group1;
3,Dan, Group2;
/.
/.
i split the line from the "\\,".
and get a String[].
public enum Group {
GROUP1, GROUP2, GROUP3;
}
class A {
private int num1;
private String name;
private Group group;
A(String[] data){
this.num = Integer.parseint(data[0]);
this.name = data[1];
this.group = ??///my problem
}
}
how do i convert a string variable into an enum? is it possible?
Thanks!

New Topic/Question
Reply


MultiQuote




|