Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Value of int i=012;

 
Biju Warrier
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class Oct{
public static void main(String argv[]){
Oct o = new Oct();
o.amethod();
}
public void amethod(){
int oi= 012;
System.out.println(oi);
}
}
:roll: :roll:
 
karl koch
Ranch Hand
Posts: 388
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tricky stuff to spot (unless the classname is Oct :-) )
starting with '0' indicates octal. 012 => 10
(1 * 8 + 2 * 1)
starting with '0x' indicates hex. 0x12 => 18
(1 * 16 + 2 * 1)
k
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic