b*r
5 楼
String s1="abc";
String s2= new String(s1)
then change of s2 will not affect s1
在 huangzl (gossip) 的大作中提到: 】
String s2= new String(s1)
then change of s2 will not affect s1
在 huangzl (gossip) 的大作中提到: 】
s*h
6 楼
String s, t;
s="what are you doing?";
t="what what what";
System.out.println(t);
t=s;
System.out.println(t);
s="1.12.2.2.2.2";
System.out.println(t);
output:
what what what
what are you doing?
what are you doing?
hehe
【在 b****r 的大作中提到】
: String s1="abc";
: String s2= new String(s1)
: then change of s2 will not affect s1
: 在 huangzl (gossip) 的大作中提到: 】
s="what are you doing?";
t="what what what";
System.out.println(t);
t=s;
System.out.println(t);
s="1.12.2.2.2.2";
System.out.println(t);
output:
what what what
what are you doing?
what are you doing?
hehe
【在 b****r 的大作中提到】
: String s1="abc";
: String s2= new String(s1)
: then change of s2 will not affect s1
: 在 huangzl (gossip) 的大作中提到: 】
f*u
7 楼
class Str {
String str;
}
class HelloWorldApp {
public static void main(String[] args) {
Str s=new Str();
Str t=new Str();
s.str="1";
t.str="2";
System.out.println(t.str);
t=s;
System.out.println(t.str);
s.str="3";
System.out.println(t.str);
}
}
The result is:
2
1
3
If u use "=" to assiagn class2 to class1, both 1 and 2 contain the same
reference--point to the same object. This phenomenon is called "aliasing
【在 s**h 的大作中提到】
: String s, t;
: s="what are you doing?";
: t="what what what";
: System.out.println(t);
: t=s;
: System.out.println(t);
: s="1.12.2.2.2.2";
: System.out.println(t);
: output:
: what what what
String str;
}
class HelloWorldApp {
public static void main(String[] args) {
Str s=new Str();
Str t=new Str();
s.str="1";
t.str="2";
System.out.println(t.str);
t=s;
System.out.println(t.str);
s.str="3";
System.out.println(t.str);
}
}
The result is:
2
1
3
If u use "=" to assiagn class2 to class1, both 1 and 2 contain the same
reference--point to the same object. This phenomenon is called "aliasing
【在 s**h 的大作中提到】
: String s, t;
: s="what are you doing?";
: t="what what what";
: System.out.println(t);
: t=s;
: System.out.println(t);
: s="1.12.2.2.2.2";
: System.out.println(t);
: output:
: what what what
相关阅读
问个JAVA问题不知道发在这个版合不合适Andriod的layout文件InvokeDynamic一个问题这里有机器学习大牛没有侏儒婊子邢慧强半婊子中国海洋大学半婊子保研黑幕 2003年大连理工大学电子系考研失利的青岛二中学生邢慧强被中国海洋大学电子系破格录取为中国海洋大学电子系的硕士,如果给半婊子中国海洋大学加上一个形容词的问个 Generic 的问题spring mvc 里面 view 必须是 jsp吗?本地spring,网络mysql,必须port forwarding吗?网上找了贪吃蛇的程序,请问如何run这些程序?这周抽空研究了一下Nathan的那篇CAP的blog问一个弱智问题,关于调用package或者包的如何将分散的数据库汇总到Cloud?HashMap一问问两个语法问题请教String.split的regular expressionAnybody evaluated/used javalite?哪位大虾总结一下Java学习的路径步骤和所需的时间看了下storm,大概明白了怎么做real time系统了Sun Java 被 Oracle 收购后,