How To Use Enum in Java Programming Language
The Following script is the simplest way to declaring and using Enum in Java:
package useenum;
enum Student{
Gracie, Angelin, Gracelyn
}
public class UseEnum {
public static void main(String[] args) {
for (Student std : Student.values()) {
System.out.println(std);
}
}
}
output:
ShadowOfBdg© - All rights reserved.
No comments:
Post a Comment