Oracle
1Z0-819 · Question #60
Given public enum Color implements Serializable { R(1), G(2), B(3); int c; public Color(int c) { this.c = c; } } What action ensures successful compilation?
The correct answer is A. A. Replace public Color(int c) with private Color(int c). See the full explanation below for the reasoning.
Question
Given
public enum Color implements Serializable {
R(1), G(2), B(3);
int c;
public Color(int c) {
this.c = c;
}
}
What action ensures successful compilation?
Options
- AA. Replace public Color(int c) with private Color(int c).
- BB. Replace int c; with final int c;.
- CC. Replace int c; with private final int c;.
- DD. Remove implements Serializable with public enum Color.
- EE. Replace enum Color with public enum Color.
How the community answered
(38 responses)- A82% (31)
- B5% (2)
- C11% (4)
- E3% (1)
Community Discussion
No community discussion yet for this question.