wood burning stoves 2.0*
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "octal values in int" Watch "octal values in int" New topic
Author

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.


Mani
Quaerendo Invenietis
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: octal values in int