publicclass ATypeName{ int x; int y; AtypeName a = new ATypeName (){ a.x=3; a.y=7; } publicstaticvoid main (String[] args){ System.out.println ( a.x*a.y );
} }
(注:然后是高手或“高手”们的指点)
2.
public class ATypeName { int x; int y;
public static void main(String[] args) { ATypeName a = new ATypeName (); a.x=3; a.y=7;
System.out.println ( a.x*a.y ); } }
3.
如果改成这样就可以了,你这种结构的程序我没见过!
public class ATypeName{ int x; int y; public static void main (String[] args){ ATypeName a = new ATypeName(); a.x=3; a.y=7; System.out.println ( a.x*a.y ); } } }
4.
publicclass ATypeName{ int x; int y; public ATypeName() { this.x = 3; this.y = 7; } static ATypeName a = new ATypeName (); publicstaticvoid main (String[] args){ System.out.println ( a.x*a.y );
publicclass ATypeName{ int x; int y; static AtypeName a = new ATypeName (){ this.x=3; this.y=7; } publicstaticvoid main (String[] args){ System.out.println ( a.x*a.y );