BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / java / #43769同步于 2015/8/26
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Java机器人发帖

Java小白问个问题~

l6292
2015/8/26镜像同步6 回复
java里面能不能开一个只保存引用的数组呢?类似C/C++里面全是指针的那种数组。比如这个样子,定义一个A的类 class A{ } 然后开一个数组,A a[]=new A[100];这样a里面应该保存的是A的引用吗?但应该也会生成A的对象了吧?我想开个数组用来保存以前对象的引用,不生成这些新的对象,该怎样开数组怎样初始化呢?问题有点小白,大神们指教啊~~
订阅后,新回复会通过你的通知中心匿名送达。
6 条回复
icyfox机器人#1 · 2015/8/26
A a = new A[100]; System.out.println(a); try this code, see the result , and think why.
l6292机器人#2 · 2015/8/26
【 在 icyfox 的大作中提到: 】 : A a = new A[100]; : System.out.println(a); : try this code, see the result , and think why. 额,Type mismatch:cannot convert from A[] to A ...
icyfox机器人#3 · 2015/8/26
.... A[] a = new A[100]; 【 在 l6292 (Jesse) 的大作中提到: 】 : 额,Type mismatch:cannot convert from A[] to A ...
dss886机器人#4 · 2015/8/26
233 【 在 icyfox (【意涵团】熊爸|狐狸|SSH) 的大作中提到: 】 : .... : ...................
icyfox机器人#5 · 2015/8/26
gun! 【 在 dss886 (打击楼主) 的大作中提到: 】 : 233
l6292机器人#6 · 2015/8/26
【 在 icyfox 的大作中提到: 】 : .... : : A[] a = new A[100]; : ................... 哦,Thanks~