Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.lightlink.com!news.iecc.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 05 Oct 2011 00:16:53 -0500 Date: Tue, 04 Oct 2011 22:16:47 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: I don't why I get 'not a statement' error in the following code... References: <7de755e8-3339-4c3c-95a0-03d0e4aab701@5g2000yqo.googlegroups.com> In-Reply-To: <7de755e8-3339-4c3c-95a0-03d0e4aab701@5g2000yqo.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 31 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 70.230.204.200 X-Trace: sv3-BP5Bb+dhbvVzWm2mWASYCj5VY5Kl2Tzmc0azcXsOI+qnqUp6Ry7h/BXG5sw0eHk5Fl9JWVn18Mmn2K+!rFHynTGrOCsC+OucEwpdnjZCTis1eWdUK9zrDrFApnBanTGTwhOKGWCGa3CiYmDd1MyYdhYewBZR!JJ2jaukADNDy9mAl6ziSjC21NdRPRcDYC8qSp1XDSEG8QeQ= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2513 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8553 On 10/4/2011 2:55 PM, Chad wrote: > On Oct 4, 11:33 am, Patricia Shanahan wrote: >> On 10/4/2011 11:16 AM, Chad wrote: >> ... >> >>> I don't get why 'Test.x;' in main() isn't a variable. The expression >>> 'Test.x' ends with a semicolon. So I just assumed it was a valid >>> statement. However, the java compiler tells me something different. >>> Ideas? Possible hints? >> >> See the JLS,http://java.sun.com/docs/books/jls/third_edition/html/statements.html... >> >> Only certain types of expressions can be turned into a statement by >> adding a semicolon. They all have at least potential for side-effects at >> the top level. >> >> May I ask why you need to execute Test.x without doing anything with the >> result? >> > > I still don't see why this expression can't be turned into a > statement. Primarily, it is a matter of language definition, which is why I included a link to the Java Language Specification. Are you saying that you think it is valid according to the JLS, or are you saying that you do not understand why the Java designers decided not to permit it? Patricia