What is the output of the following code?
class Test { private final int y; public Test() { this(20); y = 10; System.out.println(y); } public Test(int z) { y = z; System.out.println(y); } } public class Main { public static void main(String[] args) { new Test(); } }
y = 10;//The final field y may already have been assigned
Both constructors initialize the blank final instance variable y.
No-args constructor calls another constructor.