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.
Java
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback