0
Anybody explain the output?
public class Main { public static void main(String[] args) { int x= 010; int y= 6; System.out.println(x); System.out.println(y); } } output is :8 & 6 . explain how is it 8...
5 Answers
+ 4
The literal expression which is assigned to the x var is an octal ( 8-base ) notation: in Java, octal numbers starting with a 0 ;)
+ 2
ASCII
Octal number of 8 is 010.
Look at the table:
http://www.asciitable.com/index/asciifull.gif
+ 2
@Uran Kajtazaj:
It isn't necessary an Ascii code, it's just an integer value ^^
+ 2
@Uran Kajtazaj:
I already answered:
It isn't necessary an Ascii code, it's just an integer value ^^
+ 1
please explain the difference of my answer with yours