   compiler error
  [Writing in Java using javac to compile]I am getting an "identifier expected" error that I don't understand. Here is my code:// Outisde my JApplet...class Widget {    int a,b,c;    Widget() {   a = b = c = -1;    }}// Jumping inside my JApplet...Widget w = new Widget();w.a = 40;w.b = 50;w.c = 60;In the example above, I am generating three identifer expected errors at the assignment statements, such as "w.a = 40;". The caret that javac uses to pinpoint the location of the error identifies the assignment operator (=) as the culprit, or at least as the source of deviation.What's going on here?   
  While I know almost nothing about Java, I assume its default access is private, like in C++. So that means you need to make a, b and c public.   ;Quote:Original post by dalepWhile I know almost nothing about Java, I assume its default access is private, like in C++. So that means you need to make a, b and c public.Good thought; in Java the default is "package" (something more like protected than private). However, if that would be the problem, then also the "new" operation would not work, since also the initializer is "package" visible only. Moreover the whole class is "package" visible only.I can't see anything invalid in the presented code snippets. Perhaps the package declarations are wrong, so that the both Widget classes seen are not the same? You may need to show more of the environment ...;Quote:Original post by haegarrGood thought; in Java the default is "package" (something more like protected than private).Isn't that for functions or something? I'm 99% sure member variables are private by default... (haven't actually checked it though) However, if that would be the problem, then also the "new" operation would not work, since also the initializer is "package" visible only. Moreover the whole class is "package" visible only.I can't see anything invalid in the presented code snippets. Perhaps the package declarations are wrong, so that the both Widget classes seen are not the same? You may need to show more of the environment ...;Quote:Original post by SpoonbenderQuote:Original post by haegarrGood thought; in Java the default is "package" (something more like protected than private).Isn't that for functions or something? I'm 99% sure member variables are private by default... (haven't actually checked it though)Yes, its true for functions and something (if you mean an inclusive "or" and member variables with "something" ;-) But seriously, member variables are not private but package visible at default (to be sure I've tested it just now w/ Java 1.5, and I think it wasn't different under the previous versions down to 1.2 at least).   ;  You have to write your assignements inside of a method of a class.;  I think you should try putting the public: access identifier there just to rule out that idea.   