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
Win a copy of
Communication Patterns: A Guide for Developers and Architects
this week in the
Design and Architecture
forum!
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
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Programmer Certification (OCPJP)
am confusing in operator precednce pls explain me
giribabu rosi
Greenhorn
Posts: 17
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
1+2*3%4+5/4
Rohan Kayan
Ranch Hand
Posts: 123
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
1+2*3%4+5/4
= 1+((2*3)%4)+(5/4)
= 1+(6%4)+1
= 1+2+1
= 4
As the precedence of * / % are same they will calculate left to right , that's why 2*3 and 5/4 will be the first operation , then 6%4 and then the sum of all three.
SCWCD 1.4, SCJP 1.4
You can't expect to wield supreme executive power just because
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Mock question
Flow control
Diff between Hashcode and equals
Write a getter and setter to each private field
Somebody in office on a saturday
More...