[658] in java-interest
2D-arrays
daemon@ATHENA.MIT.EDU (Francois BOUSSARD)
Wed Jul 12 11:58:48 1995
Date: Wed, 12 Jul 1995 16:38:57 +0200
From: Francois BOUSSARD <francois@coplanet.fr>
To: java-interest@java.sun.com
Hi java-ists (*-*).
Well, I tried to write some codes with 2-dimensional arrays
In java, the doc says that T[][] declares T as an array OF array ->
it's means - at my mind - that :
T[x][y] is an item
T[x] is an array of items
T is an array of arrays of items
Isn't there the meaning of this syntax ?
So, in my way, i though that line :
C T[][]=new C[40][];
would allocate all the elements T[x]=NULL.
So, after, i'd could do T[x][0]=new C[20];
Well, that's what i understood :-) .
In fact, when i tried this code below, i got-back the error message
added after code.
Is it a bug, or a mistake from me ?
//**************************** CODE
class c {
int x,y;
}
class o {
c tabc[][]=new c[40][];
public void Do(){
System.out.println("Do in :"+tabc+" [0] :"+tabc[0]);
tabc[0]=new c[5];
System.out.println("Do out");
}
}
class t {
public static void main (String args[]) {
o obj;
obj=new o();
obj.Do();
}
}
>************************************* Error received
Do in :class[40] [0] :<Null Object>
SIGSEGV 11* segmentation violation
si_signo [11]: SIGSEGV 11* segmentation violation
si_errno [0]: Error 0
si_code [1]: SEGV_ACCERR [addr: 0x5a]
stackbase=EFFFF9FC, stackpointer=EFFFF818
Full thread dump:
"Async Garbage Collector" (0x10267730): priority=1
"Finalizer thread" (0x102676d8): priority=1
"Idle thread" (0x102676c8): priority=0
"clock handler" (0x102676b8): priority=11
"main" (0x102676b0): priority=5 *current thread*
o.Do(t.java:12)
t.main(t.java:24)
Monitor Cache Dump:
Registered Monitor Dump:
Has finalization queue lock: unowned
Finalize me queue lock: unowned
Thread queue lock: unowned
Class lock: unowned
Java stack lock: unowned
Code rewrite lock: unowned
Heap lock: unowned
Allocation lock: unowned
Monitor registry: monitor owner: "main" (0x7e4b0)
Monitor cache lock: unowned
Event monitor: unowned
I/O monitor: unowned
Alarm monitor: unowned
Waiting to be notified:
"clock handler" (0x102676b8): priority=11
Thread Alarm Q:
>***********************************
Isn't it a beautifull error code : that's not so easy to get
one so detailed :
/!!!!!\
/ ~ ~ \
( 0 0 )
\ | /
\`-'/
`-'
Bye, see you soon <-> .
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com