public class Ceshi{
public String str = “”;
public Ceshi objCeshi; public Ceshi(String str2){
this.str = str2;
}
public getString(String str3){
objCeshi = new Ceshi(str3);
}
public static void main(String[] args){
Ceshi obj = new Ceshi(“hello”);
Obj.getString(“word”);
System.out.println(obj.str);
}
}
A.hello
B.helloword
C.word
D.wordhello

解决方案 »

  1.   

    hello
    这样
      

  2.   

    hello ,初始化对象时,obj.str="hello",后面的Obj.getString(“word”);是设置obj.objCeshi.str="world".这里输出的是obj.str,所以选A
      

  3.   

    你这个程序代码有几处错误。
    你那个getSting没有定义返回类型,
    Ceshi obj = new Ceshi(“hello”);
    Obj.getString(“word”);
    o有个大小写错误。输出hello
      

  4.   

    会报错啊,不报错那就是world,o小写