What will be the result of the following code compilation and execution?

public class Test {
    final String s;
    
    public Test() {
        s = "default";
    }
    
    public Test(String s) {
    }
    
    public static void main(String[] args) {
        System.out.println(new Test().s);
    }
}

Compilation error can be skipped and "default" will be displayed.

2015 Nov 28, 11:51:57 AM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes