File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Arrays" Watch "Arrays" New topic


Mwenya Chongo

Joined: Dec 15, 2010
Posts: 10
Hi. am new at Java and am just teaching myself. I hope through the forums I will able to gather as much help and advise. To day I want top know how to declare an array in a class outside the main method. And how to declare the array in the constructor.

I hope am not being too... "£$%%^^&**((). This will be my starting point.

Thank you very much
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33119

Do you know how to declare an array inside a method?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Colm Dickson
Ranch Hand

Joined: Apr 04, 2009
Posts: 89
The folowing is a good link. Arrays can be declares with a certain size and the you can explicitly assign values to each element or you can declare and assign values in one go using the curly braces as can be seen in the following link

I agree. Here's the link:
subject: Arrays
It's not a secret anymore!