Article View: cn.bbs.comp.lang.java
Article #12216���鲻�˽��,˳�㿴����һ����
From: ��������
Date: Wed, 04 Aug 2004 01:42
Date: Wed, 04 Aug 2004 01:42
64 lines
2577 bytes
2577 bytes
Ҳ��Դ������߰�
-----------------------------------------------------------------------------
class Weeble {}
public class ArraySize {
public static void main(String[] args) {
// Arrays of objects:
Weeble[] a ; // Local uninitialized variable
Weeble[] b = new Weeble[5]; // Null references
Weeble[] c = new Weeble[4];
System.out.println("b.length = " + b.length);
for(int i = 0; i < b.length; i++)
System.out.println("b[" + i + "]=" + b[i]);
System.out.println("c.length = " + c.length);
for(int i = 0; i < c.length; i++)
System.out.println("c[" + i + "]=" + c[i]);
// Dynamic aggregate initialization:
a = new Weeble[6];
System.out.println("a.length = " + a.length);
for(int i = 0; i < a.length; i++)
System.out.println("a[" + i + "]=" + a[i]);
a = new Weeble[]{new Weeble(), new Weeble()};
System.out.println("a.length = " + a.length);
for(int i = 0; i < a.length; i++)
System.out.println("a[" + i + "]=" + a[i]);
b = new Weeble[]{new Weeble(), new Weeble(),new Weeble(), new Weeble
(),new Weeble()};
System.out.println("b.length = " + b.length);
for(int i = 0; i < b.length; i++)
System.out.println("b[" + i + "]=" +b[i]);
}
}
---------------------------------------------------------------------------
������Ϊ:
b.length = 5
b[0]=null
b[1]=null
b[2]=null
b[3]=null
b[4]=null
c.length = 4
c[0]=null
c[1]=null
c[2]=null
c[3]=null
a.length = 6
a[0]=null
a[1]=null
a[2]=null
a[3]=null
a[4]=null
a[5]=null
a.length = 2
a[0]=Weeble@372a1a
a[1]=Weeble@ad3ba4
b.length = 5
b[0]=Weeble@26b249
b[1]=Weeble@82f0db
b[2]=Weeble@92d342
b[3]=Weeble@6b97fd
b[4]=Weeble@c78e57
----------------------------------------------------------------------------
--
[1;36m�� ��Դ:���Ұ��Ͽ�վ nkbbs.org ��Web[FROM: 202.113.183.17][m
Technical Details
Message-ID:
<4DUHWX$AeU@bbs.nankai.edu.cn>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!ngpeer.news.aol.com!feed2.newsreader.com!newsreader.com!maily.cic.tsinghua.edu.cn!news2.happynet.org!NanKaiShow Full Headers
Complete Article Headers
X-Google-Thread: f6cb0,73d92350da43c665,start X-Google-Attributes: gidf6cb0,public X-Google-Language: ENGLISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!ngpeer.news.aol.com!feed2.newsreader.com!newsreader.com!maily.cic.tsinghua.edu.cn!news2.happynet.org!NanKai From: liutjedu.bbs@bbs.nankai.edu.cn (��������) Newsgroups: cn.bbs.comp.lang.java Subject: ���鲻�˽��,˳�㿴����һ���� Date: 04 Aug 2004 01:42:57 GMT Organization: �Ұ��Ͽ�վ Message-ID: <4DUHWX$AeU@bbs.nankai.edu.cn> X-Filename: Java/M.1091583777.A