Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #8552

Re: I don't why I get 'not a statement' error in the following code...

From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
Newsgroups comp.lang.java.programmer
Subject Re: I don't why I get 'not a statement' error in the following code...
References <de7d2141-f562-452d-b754-46cab58ef211@d18g2000yql.googlegroups.com> <ut2dnZcFmYX1zBbTnZ2dnUVZ_q2dnZ2d@earthlink.com> <7de755e8-3339-4c3c-95a0-03d0e4aab701@5g2000yqo.googlegroups.com> <3uLiq.5280$yO1.4957@newsfe21.iad> <9a31535b-20bd-4213-ab38-8e7d1bd1a7a3@dd6g2000vbb.googlegroups.com>
Message-ID <SyNiq.2724$pH6.86@newsfe10.iad> (permalink)
Date 2011-10-04 17:30 -0700

Show all headers | View raw


On 10/4/11 3:11 PM, Chad wrote:
> On Oct 4, 3:09 pm, Daniel Pitts<newsgroup.nos...@virtualinfinity.net>
> wrote:
>> On 10/4/11 2:55 PM, Chad wrote:
>>
>>
>>
>>> On Oct 4, 11:33 am, Patricia Shanahan<p...@acm.org>    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.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

I don't why I get 'not a statement' error in the following code... Chad <cdalten@gmail.com> - 2011-10-04 11:16 -0700
  Re: I don't why I get 'not a statement' error in the following code... Patricia Shanahan <pats@acm.org> - 2011-10-04 11:33 -0700
    Re: I don't why I get 'not a statement' error in the following code... Chad <cdalten@gmail.com> - 2011-10-04 11:43 -0700
      Re: I don't why I get 'not a statement' error in the following code... markspace <-@.> - 2011-10-04 12:14 -0700
      Re: I don't why I get 'not a statement' error in the following code... Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-04 12:20 -0700
    Re: I don't why I get 'not a statement' error in the following code... Chad <cdalten@gmail.com> - 2011-10-04 14:55 -0700
      Re: I don't why I get 'not a statement' error in the following code... Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-04 15:09 -0700
        Re: I don't why I get 'not a statement' error in the following code... Chad <cdalten@gmail.com> - 2011-10-04 15:11 -0700
          Re: I don't why I get 'not a statement' error in the following code... Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-04 17:30 -0700
      Re: I don't why I get 'not a statement' error in the following code... Stanimir Stamenkov <s7an10@netscape.net> - 2011-10-05 01:19 +0300
      Re: I don't why I get 'not a statement' error in the following code... Patricia Shanahan <pats@acm.org> - 2011-10-04 22:16 -0700
        Re: I don't why I get 'not a statement' error in the following code... Chad <cdalten@gmail.com> - 2011-10-05 08:13 -0700
          Re: I don't why I get 'not a statement' error in the following code... Patricia Shanahan <pats@acm.org> - 2011-10-05 10:21 -0700
          Re: I don't why I get 'not a statement' error in the following code... Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-05 20:43 -0400
            Re: I don't why I get 'not a statement' error in the following code... markspace <-@.> - 2011-10-05 19:36 -0700
              Re: I don't why I get 'not a statement' error in the following code... Lew <lewbloch@gmail.com> - 2011-10-05 19:43 -0700
  Re: I don't why I get 'not a statement' error in the following code... Roedy Green <see_website@mindprod.com.invalid> - 2011-10-05 12:00 -0700

csiph-web