FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-code-example/EnumExample/src/EnterPoint.java at master · cherkavi/java-code-example · GitHub
cherkavi
/
java-code-example
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
0
Code
Issues
0
Pull requests
42
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-code-example
/
EnumExample
/
src
/
EnterPoint.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
61 lines (48 loc) · 1.31 KB
Breadcrumbs
java-code-example
/
EnumExample
/
src
/
EnterPoint.java
Copy path
File metadata and controls
executable file
·
61 lines (48 loc) · 1.31 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/** ïðîåêò, êîòîðûé äåìîíñòðèðóåò èñïîëüçîâàíèå Enum */
public
class
EnterPoint
{
private
static
void
debug
(
Object
information
){
System
.
out
.
println
(
information
);
}
public
static
void
main
(
String
[]
args
){
debug
(
"-- begin --"
);
debug
(
" simple Example "
);
Variables
v1
=
Variables
.
V_1
;
Variables
v2
=
Variables
.
V_2
;
debug
(
"Value(1):"
+
v1
.
name
());
debug
(
"Value(2):"
+
v2
.
name
());
debug
(
"String to Variable:"
+
Variables
.
valueOf
(
"V_3"
).
name
());
debug
(
"Value(1) order:"
+
v1
.
ordinal
());
debug
(
"Value(2) order:"
+
v2
.
ordinal
());
debug
(
" complex example "
);
Widths
w1
=
Widths
.
W_1
;
Widths
w2
=
Widths
.
W_3
;
debug
(
"Widths: "
+
w1
.
getValue
()+
" ("
+
w1
.
getValue
()+
")"
);
debug
(
"Widths: "
+
w2
.
getValue
()+
" ("
+
w2
.
getValue
()+
")"
);
debug
(
"-- end --"
);
}
}
/** declaration of enumeration type */
enum
Variables
{
V_1
,
V_2
,
V_3
};
/** declaration of enumeration type with parameters */
enum
Widths
{
/** width of first */
W_1
(
5
),
/** width of second */
W_2
(
7
),
/** width of third */
W_3
(
12
),
/** width of fourth */
W_4
;
private
int
value
;
Widths
(
int
value
){
System
.
out
.
println
(
"constructor:"
+
value
);
this
.
value
=
value
;
}
Widths
(){
System
.
out
.
println
(
"constructor"
);
this
.
value
=-
1
;
}
public
int
getValue
(){
return
this
.
value
;
}
}
Back
|
FazBrowse Home
|
New Git URL