File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes assigning 09 to int datatype in java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "assigning 09 to int datatype in java" Watch "assigning 09 to int datatype in java" New topic
Author

assigning 09 to int datatype in java

v.v. krishnan
Greenhorn

Joined: Feb 02, 2002
Posts: 2
public class numbers
{
public static void main(String s[])
{
int a =09;
int b = 08;
System.out.println( a + b);
}
}

when i try to assign the value 08 (or) 09 in java it throws an compile time error "09 too large" "08 too large". it compiles fine if i use anything less than 08. any suggestion please.
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
When you preceed a number with a zero, it denotes that the number is a Octal number. Since the range of Octal number is from 0 to 7, the compiler gives an error when you try to assign a value greater than 7.


Mani
Quaerendo Invenietis
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: assigning 09 to int datatype in java
 
Similar Threads
java.rmi.ConnectException
doubt in mock exam java belt
Need Help For Exam .
Why is so???????
android uncaught handler: thread main exiting due to uncaught exception