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)
unreachable code
Mike Ngo
Ranch Hand
Posts: 89
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Does anyone know why line 2 is OK?
1) int x = 0;
2) if (false) { x=1; } // OK
3) while (false) { x=2; } // error - unreachable code
Henry Wong
author
Posts: 23951
142
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
It is actually mentioned in the specification. The reason it is okay is to allow for conditional code... like ...
boolean isDebugging = false; if (isDebugging) { // Log debugging messages here }
Henry
Books:
Java Threads, 3rd Edition
,
Jini in a Nutshell
, and
Java Gems (contributor)
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
assertions
unreachable statement
What is this unreachable error
Unreachable Statement
Unreachable Code
More...