What will be printed out to console?

public class A {
    public static void main(String[] sr) {
        int a = 010;
        System.out.println(a);
    }
}
Explanation
8 is the correct answer. Since radix for integer literals is determined by the first digit, then, in this particular case, 0 (the first digit) - is an octal number.

Follow CodeGalaxy

Mobile Beta

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