File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes what is meant  by jagged array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "what is meant  by jagged array" Watch "what is meant  by jagged array" New topic
Author

what is meant by jagged array

saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
can any one tell me what is a jagged array
i nerver gone thru this word in java books


thanks in advance


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

A jagged or rugged array is when you have a non uniform array.

A 2 X 2 array will look like this

00
00

A rugged or jagged array might look like this.

00000
00
0000000
0000
00
0

This is achieved when defining the array. You mention that this is an array with 6 elements of depth but you add the width whenever you want with the new operator.

This would not fit under advanced though


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
thanx,but can i create a jagged array in java ?? is it really helpful for a programmer
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Yes you most certainly can



There are some cases when this can be helpful. Say you have a list of things to add to a data structure like the following...

apple orange
one two four nine seven
bla bla bla

You can put it in a rugged array and then serialize the data in case you want to save it. I have not used rugged/jagged arrays at work ( yet )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is meant by jagged array