-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example.java
35 lines (27 loc) · 985 Bytes
/
Example.java
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
package com.trl.theoreticalKnowledge._enum.enumConstructor.a.a1;
public class Example {
public static void main(String[] args) {
System.out.println(Color.WHITE);
}
}
enum Color {
WHITE("#ffffff"),
BLACK("#000000"),
RED("#ff0000"),
YELLOW("#ffff00");
private String hexColorCode;
private Color(String hexColorCode) {
this.hexColorCode = hexColorCode;
}
Color(String hexColorCode, String somthingValue) {
this.hexColorCode = hexColorCode;
}
// The code will not compile with a public access modifier of constructor.
// public Color(String hexColorCode, String somthingValue, String somthingValue_2) {
// this.hexColorCode = hexColorCode;
// }
// The code will not compile with a protected access modifier of constructor.
// protected Color(String hexColorCode, String somthingValue, String somthingValue_2, String somthingValue_3) {
// this.hexColorCode = hexColorCode;
// }
}