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


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

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Stanimir Stamenkov <s7an10@netscape.net>
Newsgroups comp.lang.java.programmer
Subject Re: I don't why I get 'not a statement' error in the following code...
Date Wed, 05 Oct 2011 01:19:17 +0300
Organization A noiseless patient Spider
Lines 71
Message-ID <j6g0p4$6vm$1@dont-email.me> (permalink)
References <de7d2141-f562-452d-b754-46cab58ef211@d18g2000yql.googlegroups.com> <ut2dnZcFmYX1zBbTnZ2dnUVZ_q2dnZ2d@earthlink.com> <7de755e8-3339-4c3c-95a0-03d0e4aab701@5g2000yqo.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
Injection-Date Tue, 4 Oct 2011 22:19:16 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="7eOF4vEIiUU6n7fF+lWgFg"; logging-data="7158"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19U9nKXewZGIbIvFB4nKEtx"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110928 Firefox/7.0.1 SeaMonkey/2.4.1
In-Reply-To <7de755e8-3339-4c3c-95a0-03d0e4aab701@5g2000yqo.googlegroups.com>
X-Face "@)%Vlap6d%OVYDS}B4YUWE@yUy+^!w/+.q.,c5kjI#+uG?kYP&r/pTjNWgo:g[A,O=AL3/ j&4Le2cau$<e=FPq~GbeZ6DW1Grey[VHn8?ktzvoQtzlg;]&rh8g]CD+_BC7d[gW{Yx&_X*4Q$h&nJ l@t(|4R4:T='&]U#ui+z9OC$.~gJjU93kh:Ojc$Cz0n#I9!~!9ay?E<UlW&5,IFX1*KtA>MYEFst$y y"m]M7tq\S(>[a$x0x8%S
Cancel-Lock sha1:QUld3UVRto1bn42sAfqO53NqXkg=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8551

Show key headers only | View raw


Tue, 4 Oct 2011 14:55:12 -0700 (PDT), /Chad/:
> On Oct 4, 11:33 am, Patricia Shanahan wrote:
>
>> 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.

Because it doesn't match any of the syntax constructions given in 
the Java Language Specification referenced above (learn to read):

        LocalVariableDeclarationStatement
        ClassDeclaration
        Statement

Your statement |Test.x;| is obviously not a local variable 
declaration nor class declaration, further:

Statement:
        StatementWithoutTrailingSubstatement
        LabeledStatement
        IfThenStatement
        IfThenElseStatement
        WhileStatement
        ForStatement

Yours is none of labeled, if-then, if-then-else, while or for 
statement, so:

StatementWithoutTrailingSubstatement:
        Block
        EmptyStatement
        ExpressionStatement
        AssertStatement
        SwitchStatement
        DoStatement
        BreakStatement
        ContinueStatement
        ReturnStatement
        SynchronizedStatement
        ThrowStatement
        TryStatement

The only posibility here is expression statement:

ExpressionStatement:
        StatementExpression ;

StatementExpression:
        Assignment
        PreIncrementExpression
        PreDecrementExpression
        PostIncrementExpression
        PostDecrementExpression
        MethodInvocation
        ClassInstanceCreationExpression

Which of the given above should match your statement?  Yours is 
neither assignment nor pre-increment, nor pre-decrement, nor 
post-increment, nor post-decrement, nor method invocation, nor 
class instance creation.

-- 
Stanimir

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