帮忙瞧下了,我找不出原因。
package liuting1;public class StaticTest
{
public static void main(String[]agrs)
{
MyStatic mystatic = new MyStatic();
// MyStatic mystatic2 = new MyStatic();
MyStatic.a =10;
System.out.println(mystatic.a );
}
}
class MyStatic
{
static int a;
}
//为什么提示这个呢?The static field MyStatic.a should be accessed in a static way.