更多JAVA程序设计试题
- 1请阅读下面的程序,选择正确的运行结果。class Demo{private static int x ;public static void main(String[] args){System.out.println(x++);}}
- 2下列关于this的说法中,错误的是( )
- 3请阅读下面的程序,程序的运行结果是()。class Person {String name;int age;public Person() {}public Person(String n, int a) {name = n;age = a;}public void show() {System.out.print(name + "---" + age +"");}}public class Test {public static void main(String[] args) {Person p1 = new Person();p1.show();Person p2 = new Person("周星驰", 27);p2.show();}}
- 4下列数据类型进行运算时,哪一个会发生自动类型提升
- 5自定义运行时异常,必须继承自()类
- 6编译并运行下面的Java程序,将产生?class?A{int var1=1;int var2;public?static?void?main(String[]?args){int?var3=3;A?a=new?A();System.out.println(a.var1+a.var2+var3);???}}