Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Question re testing constructor Date: Wed, 7 Dec 2011 07:12:51 -0800 (PST) Organization: http://groups.google.com Lines: 29 Message-ID: <27192987.347.1323270771743.JavaMail.geo-discussion-forums@prez5> References: Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 173.164.137.214 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1323270772 11348 127.0.0.1 (7 Dec 2011 15:12:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 7 Dec 2011 15:12:52 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10593 Stefan Ram wrote: > Something similar: >=20 > It is difficult for me to forecast an =EF=BF=BDunreachable statement=EF= =BF=BD error. > For example, I would have expected such an error for >=20 > public class Main > { public static void main( final java.lang.String[] args ) > { java.lang.System.out.println( "alpha3" ); > if( true )return; > java.lang.System.out.println( "beta3" ); }} >=20 > , but did *not* get one, however, the compiler knows that the > beta3 statement *is* unreachable, because he does not care to > compile it. >=20 > Omitting the =EF=BF=BDif( true )=EF=BF=BD will give an =EF=BF=BDunreach= able statement=EF=BF=BD > error. You should read the JLS, 14.21: "The if statement, whether or not it has an else part, is handled in an unu= sual=20 manner. For this reason, it is discussed separately at the end of this sect= ion." --=20 Lew