Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe10.iad.POSTED!83aa503d!not-for-mail From: Daniel Pitts User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 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> <3uLiq.5280$yO1.4957@newsfe21.iad> <9a31535b-20bd-4213-ab38-8e7d1bd1a7a3@dd6g2000vbb.googlegroups.com> In-Reply-To: <9a31535b-20bd-4213-ab38-8e7d1bd1a7a3@dd6g2000vbb.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Lines: 42 Message-ID: X-Complaints-To: abuse@newsrazor.net NNTP-Posting-Date: Wed, 05 Oct 2011 00:30:42 UTC Date: Tue, 04 Oct 2011 17:30:42 -0700 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8552 On 10/4/11 3:11 PM, Chad wrote: > On Oct 4, 3:09 pm, Daniel Pitts > wrote: >> On 10/4/11 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. >> >>> Chad >> >> What does "Test.x;" mean to you? If it successfully compiled, what would >> you expect that it does? >> >> Test.x is a variable reference, you either need to read it or write it. > > I thought it did the same thing as something like a.x > > Chad Okay, what does "a.x" mean to you? Same question. a.x; will not compile.