public class P { int x; public P(int x) { this.x = x; } }
P a = new P(1);
System.out.println(a);What is printed?
- Acheck_circle
Something like P@1a2b3c (hash code form)
- B
1
- C
Compile-time error
- D
P
Explanation
Without toString override, Object.toString returns "ClassName@hex".