java非法的表达式开始
publicclassMain{publicstaticvoidmain(Stringargs[]){privateinta=1;intb=2;protectedintc...
public class Main{
public static void main(String args[]){
private int a = 1;
int b =2;
protected int c = 3;
public int d = 4;
System.out.println(a+" "+b+" "+c+" "+d);
}
} 展开
public static void main(String args[]){
private int a = 1;
int b =2;
protected int c = 3;
public int d = 4;
System.out.println(a+" "+b+" "+c+" "+d);
}
} 展开
2个回答
展开全部
public class Main {
public static void main(String[] args) {
/**
* 这里面不应该有private这种限定符
*/
private int a = 1;
int b = 2;
protected int c = 3;
public int d = 4;
System.out.println(a + " " + b + " " + c + " " + d);
}
}
改写如下
public class Main {
private int a = 1;
int b = 2;
protected int c = 3;
public int d = 4;
public static void main(String[] args) {
Main m = new Main();
m.display();
}
private void display() {
System.out.println(a + " " + b + " " + c + " " + d);
}
}
或者
public class Main {
private static int a = 1;
static int b = 2;
static protected int c = 3;
static public int d = 4;
public static void main(String[] args) {
System.out.println(a + " " + b + " " + c + " " + d);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询