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
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
这样
你那个getSting没有定义返回类型,
Ceshi obj = new Ceshi(“hello”);
Obj.getString(“word”);
o有个大小写错误。输出hello