Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要同时在两个变量中获取新对象的引用。类似的东西
Object o1,o2 = new Object();
这是可能的吗?
提前致谢..
试试这个:
Object o1 ,o2; o1 = o2 = new Object();
为什么不只是:
object o1 = new object(), o2 = o1;
?