Refer to the program below and let me know Why output is coming like this.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, April 30, 2001 02:56 AM

public class Inttest { public static void main(String[] args) { int a,b; a=025; b=021; System.out.println("a value is"+a); System.out.println("b value is"+b); } } Iam also giving details about this programme.If i compile this program with different integers the output is like intvalue output 01 1 02 2 03 3 04 4 05 5 06 6 07 7 08 Intno too large 09 Intno too large 010 8 011 9 012 10 013 11 014 12 015 13 016 14 017 15 018 Intno too large 019 Intno too large    More>>

public class Inttest
{
public static void main(String[] args)
{
int a,b;
a=025;
b=021;

System.out.println("a value is"+a);
System.out.println("b value is"+b);

}
}

Iam also giving details about this programme.If i compile this program with different integers the output is like
intvalue output
01 1
02 2
03 3
04 4
05 5
06 6
07 7
08 Intno too large
09 Intno too large
010 8
011 9
012 10
013 11
014 12
015 13
016 14
017 15
018 Intno too large
019 Intno too large
020 16
021 17

   <<Less

Re: Refer to the program below and let me know Why output is coming like this.

Posted By:   Misha_Dorman  
Posted On:   Monday, April 30, 2001 03:41 AM

01 = 1 octal = 1 in decimal

02 = 2 octal = 1 in decimal

07 = 7 octal = 7 in decimal

08 = 8 octal which is not valid

09 = 9 octal which is not valid

10 = 10 octal = 8 in decimal

...

17 = 17 octal = 15 in decimal

18 = 18 octal which is not valid
About | Sitemap | Contact