Chat > Entertainment & Technology

Java Arrays of objects

(1/1)

M3ta7h3ad:
I feel so n00bish for posting this but has to be done as ive drawn a blank and my brain is empty.

I have the following


--- Code: ---

javax.swing.JLabel [] thumbLbl = new javax.swing.JLabel();


--- End code ---


but now I want to initialise that array with a size.

I thought it was something along the lines of


--- Code: ---thumbLbl[] = thumbLbl[files.length];
--- End code ---


but its wrong. Any ideas folks?

This is such a simple question just I cant remember it.

M3ta7h3ad:
lol what a gimp :)

Twas easy.


--- Code: ---
javax.swing.JLabel thumbLbl = new javax.swing.JLabel[files.length];

--- End code ---


Dah cant believe I couldnt think of it. :D

Navigation

[0] Message Index

Go to full version