The moose likes Beginning Java and the fly likes array of object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "array of object" Watch "array of object" New topic

array of object

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635

There is error in creating array. why?

Rob Spoor

Joined: Oct 27, 2005
Posts: 20136

Did you put this code in a method or constructor? Can you post the compiler error?

How To Ask Questions How To Answer Questions
James Elsey
Ranch Hand

Joined: Dec 21, 2007
Posts: 228

The bottom half is outside of the class, do you mean to put it inside its own method or in a constructor?

Please tell us what you want to do, and we can answer better

Kind Regards, James. OCPJP 1.6 || My SCJP / OCJCP Study Notes
Interested in : SCJP, Google App Engine, Stripes, Android;|| My Bite-Size SCJP Study Blog
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

see this should work fine

SCJP6.0,My blog Ranchers from Delhi
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

in Java,Everything should be there inside a class.
Class acts like a template that describes the kinds of state and behavior that objects
of its type support
I agree. Here's the link:
subject: array of object
It's not a secret anymore!