-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.java
More file actions
37 lines (32 loc) · 733 Bytes
/
Example.java
File metadata and controls
37 lines (32 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* @author viktorvoltz
*/
public enum Example {
WALK("press to walk"),
RUN("press to run"),
JUMP("press to jump"),
SIT("press to sit");
private String description;
private Example(String description){
this.description = description;
}
@Override
public String toString() {
String id = name(); //name from java.lang.Enum.name()
return id;
}
public String getDescription(){
return description;
}
public static void main(String[] args) {
for(Example e : Example.values()){
System.out.println(e + ": " + e.getDescription());
}
}
}
/*
WALK: press to walk
RUN: press to run
JUMP: press to jump
SIT: press to sit
*/