java学习笔记2:对象的"引用"之二
还是对象引用的代码,嘿嘿:
结果是什么呢,"猜"好的就看下面的答案好了
class Letter{
char c;
}
public class PassObject{
static void f(Letter y)
{
y.c='z';
}
public static void main(String[] args)
{
Letter x=new Letter();
x.c='a';
System.out.println("1: x.c="+x.c);
f(x);
System.out.println("2: x.c="+x.c);
}
}
char c;
}
public class PassObject{
static void f(Letter y)
{
y.c='z';
}
public static void main(String[] args)
{
Letter x=new Letter();
x.c='a';
System.out.println("1: x.c="+x.c);
f(x);
System.out.println("2: x.c="+x.c);
}
}
结果是什么呢,"猜"好的就看下面的答案好了
答案