题目内容

在方法内部使用,代表对当前对象自身引用的关键字是( )

A. this
B. super
C. static
D. final

查看答案
更多问题

下面程序最后输出的结果是( )public class A{ String str=new String(“good”); char[] ch={‘a’,’b’,’c’}; public static void main(String args[]){ A ex=new A(); ex.change(ex.str,ex.ch); System.out.print(ex.str+””+ex.ch[0]); } public void change(String str,char ch[]){ str=”test ok”; ch[0]=’g’; }}

A. good a
B. good g
C. test ok a
D. test ok g

下列代码中,this关键字是指( )public class Person{ String name; public void setName(String name){this.name=name; } }

A. Person类
B. Person类自身对象的引用
C. setName()方法的参数
D. setName()方法

下面程序输出的是( ) public class Animal{ int age=9; public Animal(int age){ this.age=age; } public static void main(String args[]){ Animal animal=new Animal(); System.out.println(animal.age); }}

A. 9
B. 0
C. 编译错误

下列代码中在//…处写入如下选项 ,哪个是正确的?() public class Base{ int w,x,y,z; public Base(int a,int b){ x=a; y=b; } public Base(int a,int b,int c,int d){ //… w=d; z=c; } }

A. Base(a,b);
B. x=a,y=b;
C. this(a);this(b);
D. this(a,b);

答案查题题库