class A{
public int method()
{
static int i=0;
i++;
return i;
}
public static void main(String args [])
{
A a=new A();
a.method();
int j=a.method();
System.out.println(j);
}
}
问题:static int i=0;
它说: illegal start of expression
static int i=0;
^
1 error
请高手解答!!
public int method()
{
static int i=0;
i++;
return i;
}
public static void main(String args [])
{
A a=new A();
a.method();
int j=a.method();
System.out.println(j);
}
}
问题:static int i=0;
它说: illegal start of expression
static int i=0;
^
1 error
请高手解答!!
写在函数外面。
把他拖到方法外面来。。