| 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
|
 |
 |
|
|
subject: assigning 09 to int datatype in java
|
|
|