18.分析以下代码,编译时会出现的错误信息是:
Test.
java:6ecret 可以在A中访问private
(return a.secret++; 出错)
class A{
private int secret;
}
public class Test{
public int method(A a){
return a.secret++;
}
public static void main(String args[]){
Test test=new Test();
A a=new A();
System.out.println(test.method(a));
}
}
19、分析以下程序,写出运行结果: 1234
public class Test19 {
public static void changeStr(String str){
str=”welcome”;
}
public static void main(String[] args) {
String str=”1234″;
changeStr(str);
System.out.println(str);
}
}