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

Please help  RSS feed

 
Sherry Jacob
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any1 explain how and why...

 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those results are correct. If you read the API docs for the relevant classes (Byte, Short, etc) at ( java.sun.com/j2se/1.5.0/docs/api/ ), you will see the second argument specifies the base of the first argument. So in the second example you are saying "what is the octal value 012 in decimal?". And you get the correct answer is:

(1*8) +
(2*1)
= 10
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!