Octal (base eight) integer literals

In Java octal values are denoted by a leading zero. Thus, 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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.