Question 20
Back to Exercise
What happens if A() calls this(1) and A(int x) calls this()?
- A StackOverflowError at run time
- B Compile error: recursive constructor invocation Correct
- C Each runs once
- D The compiler picks one
Correct Answer: Option B
javac detects constructor cycles.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!