Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8579
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: I don't why I get 'not a statement' error in the following code... |
| Date | 2011-10-05 12:00 -0700 |
| Organization | Canadian Mind Products |
| Message-ID | <h5ap87d7vaofugsrvipf7ms0gsckfdm8fg@4ax.com> (permalink) |
| References | <de7d2141-f562-452d-b754-46cab58ef211@d18g2000yql.googlegroups.com> |
On Tue, 4 Oct 2011 11:16:22 -0700 (PDT), Chad <cdalten@gmail.com>
wrote, quoted or indirectly quoted someone who said :
>public class hw1q3 {
Class name must start with capital letter.
See http://mindprod.com/jgloss/codingconventions.html
>
> public static void main(String[] args) {
> Test a = new Test();
> a.showAllOne();
> a.showAllTwo();
> System.out.println("The value of x is " + Test.x); //I get x
>is 2
> Test.x; //I get a compile error that says - not a statement
Test.x is a variable. You have to do something with it, e.g. pass it
as a parameter, add 1 to it. .
> }
>}
>
>class Test {
>
> public static final int w = 1;
> public static int x = 2;
> public final int y = 3;
> public int z = 4;
is real life you never expose your variables like that. You use a
getter/setter.
>
> public void showAllOne() {
> System.out.println("w is " + w);
> System.out.println("x is " + x);
> System.out.println("y is " + y);
> System.out.println("z is " + z);
> }
>
> public static void showAllTwo() {
> System.out.println("w is " + w);
> System.out.println("x is " + x);
> //System.out.println("y is " + y);
> //System.out.println("z is " + z);
> }
>}
--
Roedy Green Canadian Mind Products
http://mindprod.com
It should not be considered an error when the user starts something
already started or stops something already stopped. This applies
to browsers, services, editors... It is inexcusable to
punish the user by requiring some elaborate sequence to atone,
e.g. open the task editor, find and kill some processes.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar
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