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


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

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!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 Tue, 04 Oct 2011 13:33:12 -0500
Date Tue, 04 Oct 2011 11:33:10 -0700
From Patricia Shanahan <pats@acm.org>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Thunderbird/3.1.14
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 <de7d2141-f562-452d-b754-46cab58ef211@d18g2000yql.googlegroups.com>
In-Reply-To <de7d2141-f562-452d-b754-46cab58ef211@d18g2000yql.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <ut2dnZcFmYX1zBbTnZ2dnUVZ_q2dnZ2d@earthlink.com> (permalink)
Lines 19
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 70.230.204.200
X-Trace sv3-Bjbl2HazHXHKLU5BD6qi3SnH3SyCt8NDwp+zu7ysGr4FXG6xwbsQsgruWt1aljnzKiLDrMfi86qVkuv!7MW6ipu0knCSi/3maSy05VrazX/kOYJ0CKhrSWMxEvAbCWeOCaFkIf2aJC7d4BpdoKdZPEzJ7rVG!oyHoe6mNc7bPLbqdrW7qFnuVLhtsH/mNbON2ljA4BXis6mc=
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 1914
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8539

Show key headers only | View raw


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#14.8

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?

Patricia

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