This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Please help" Watch "Please help" New topic

Please help

Sherry Jacob
Ranch Hand

Joined: Jun 29, 2005
Posts: 128
Can any1 explain how and why...

<strong><br />Cheers !!<br /> <br />Sherry<br /></strong><br />[SCJP 1.4]
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
Those results are correct. If you read the API docs for the relevant classes (Byte, Short, etc) at ( ), 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) +
= 10
I agree. Here's the link:
subject: Please help
Similar Threads
Explanation needed for this program
Numeric Literals that include a comma
Question from appliedreasoning mock exam
Converting an octal to an int but keeping the octal number
Octal representation