This error came when my wife was doing simple programming in Java using Eclipse IDE. She was trying to do 'number to words conversion' where hard coded int input = 8; can be converted to "Eight" but not int input = 08;
It clearly says the compiler is treating this as octal literal .But this is really new to me as I am more working with C# & VB.Net which don't have this feature. After a google we were able to find the list of supported literals in Java.
http://en.wikibooks.org/wiki/Java_Programming/Literals
Leading 0 - Ocatal eg: 010 -> 8
Leaxing 0x - Hex eg: 0xA -> 10
Leading 0B - Binary eg: 0B11 -> 3 (Supported in latest Java versions >=7)
It clearly says the compiler is treating this as octal literal .But this is really new to me as I am more working with C# & VB.Net which don't have this feature. After a google we were able to find the list of supported literals in Java.
http://en.wikibooks.org/wiki/Java_Programming/Literals
Leading 0 - Ocatal eg: 010 -> 8
Leaxing 0x - Hex eg: 0xA -> 10
Leading 0B - Binary eg: 0B11 -> 3 (Supported in latest Java versions >=7)
No comments:
Post a Comment