题目内容

阅读下面代码,将会输出public class Testa {Integer a = new Integer(10);Integer b = new Integer(10);public static void main (String[ ] args){Testa testA = new Testa();if (testA.a==testA.b){System.out.print("很");}if (testA.a.equals(testA.b)){System.out.print("好");}} }

A. 很
B. 好
C. 很好
D. 抛出NullPointerException异常

查看答案
更多问题

编译运行下列程序会发生()的情况public class Mystery {String s;public static void main(String args[ ] ) {Mystery m =new Mystery();m.go();}public void Mystery() {s ="Constructor";}private void go(){System.out.println(s);} }

A. 可以编译,运行时会抛异常
B. 可以编译运行,但是控制台上什么都不输出
C. 输出“constructor”
D. 输出“null”

Thing是一个类,下面的代码可以产生()个Thing类型的对象。Thing item;Thing stuff;item = new Thing();Thing entity = new Thing();

A. 1
B. 2
C. 3
D. 4

说出A类中System.out.println的输出结果。class B{int x=100,y=200;public void setX(int x){x=x;}public void setY(int y){this.y=y;}public int getXYSum(){return x+y;}}public class A{public static void main(String[] args){B b=new B();b.setX(-100);b.setY(-200);System.out.println("sum="+b.geyXYSum());}}

说出E类中System.out.println的输出结果class A{int f(int x,byte y){return x+y;}int f(int x,int y){return x*y;}public class E{public static void main(String[] args){A a=new A();System.out.println("**"+a.f(10,(byte)10));System.out.println("##"+a.f(10,10));}}}

答案查题题库