File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes octal values in int Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "octal values in int" Watch "octal values in int" New topic

octal values in int

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
int i1 = 07; ==> no error
int i2 = 08; ==> compiler error
int i3 = 09; ==> compiler error
int i4 = 010; ==> no error

Plese explain the above nature of output.

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
The valid octal numerals are 0,1,2,3,4,5,6 and 7.
So, you get an error when you try to assign something which is not a valid octal numeral.

Quaerendo Invenietis
subject: octal values in int
It's not a secret anymore!