Mega Code Archive

 
Categories / Java Book / 001 Language Basics
 

0011 octal (base eight)

Octal values are denoted in Java by a leading zero. valid value 09 will produce an error from the compiler, since 9 is outside of octal's 0 to 7 range. public class Main { public static void main(String[] args) { int i = 010; System.out.println(i); } } The output: 8