【发布时间】:2012-03-30 16:03:24
【问题描述】:
各位大侠,这两者有什么区别。
(1)
String s = new String("hello"); // creating an object on heap then assign that object to the reference s.
(2)
String s = "hello" // did I make an object here?? Im not using the word new.
还有数组示例
int x[] = {1, 2, 3, 4, 5}; // did I make object here?
【问题讨论】:
标签: java