initialize a multi-dimentional array at declaration

Is there any way I can initialize a multi-dimentional array at declaration.

Is it possible to do the following in a single line?

Vector vClicks[] =new Vector[2];

vCliks[0] =new Vector();

vClicks[1] =new Vector();

I need to globally initialize it and then used it randomly in different methods.

Thanks

Message was edited by:

getusama

[491 byte] By [getusamaa] at [2007-11-26 15:49:35]
# 1
why do you need to do it on a single line?
georgemca at 2007-7-8 22:09:14 > top of Java-index,Java Essentials,Java Programming...
# 2

> Is there any way I can initialize a multi-dimentional

> array at declaration.

>

> Is it possible to do the following in a single line?

>

>

>Vector vClicks[] = new Vector[2];

> vCliks[0] = new Vector();

>vClicks[1] = new Vector();

> I need to globally initialize it and then used it

> randomly in different methods.

>

>

> Thanks

>

> Message was edited by:

> getusama

Vector [] v = {new Vector(), new Vector()};

~Tim

Message was edited by:

SomeoneElse

SomeoneElsea at 2007-7-8 22:09:14 > top of Java-index,Java Essentials,Java Programming...
# 3
> why do you need to do it on a single line?because java wont let me use it if i don't initialize it.Thanks someoneelse, that is exactly what i was looking for. Now both of my elements should be initialised.
getusamaa at 2007-7-8 22:09:14 > top of Java-index,Java Essentials,Java Programming...