A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Compile time unreachability
Joined: May 25, 2005
May 25, 2005 15:27:00
public static void main(
o/p on compiling - unreachable statement int a=1;
But if we replace the || by |, it works fine? How does it work?
Joined: Apr 25, 2005
May 25, 2005 18:25:00
Imagine the code is running. What will the while condition evaluate to? If you enter the loop, what happens next?
SCJP<br />SCJD - someday!
Joined: Aug 03, 2004
May 26, 2005 03:23:00
I get the error with | too. According to JLS both | and || versions should not compile. Both (false || true) and (false|true) are compile time constant expressions with value of true.
subject: Compile time unreachability
3D array Figure
Trouble Printing with java 1.4!
Sorting Array of Strings
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014