Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
Precedence Problem I guess
Nirmit Dalal
Greenhorn
Posts: 22
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
class Demo { public static void main(String args[]) { short i=056; i*=++i; System.out.println(i); }}
i tried to compute this as i=i*++i...ie i=56*57 which gives me 3192 but my program says the value is 2162
Jesper de Jong
Java Cowboy
Posts: 16084
88
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
That's essentially the same question as
this one
, which was asked recently.
Note that "056" is not the decimal number "56". It's interpreted by the compiler as
octal
, because it's prefixed with 0.
056 (octal) = 46 (decimal)
Jesper's Blog
-
Pluralsight Author Page
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
assignments and + operator
JSP called from filter not finding JavaScript file
lockCookie
Access a variable
for loop question
More...