aspose file tools*
The moose likes Beginning Java and the fly likes where is the array going to created Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "where is the array going to created" Watch "where is the array going to created" New topic
Author

where is the array going to created

anarkali perera
Ranch Hand

Joined: Sep 10, 2009
Posts: 237


if this is the my class where is the legs array created.because it is in the class not inside a method?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

It's a member variable of the class. The array will be created when you create a new dog object.

Have a look at Sun's Java tutorials, especially Lesson: Classes and Objects.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
anarkali perera
Ranch Hand

Joined: Sep 10, 2009
Posts: 237
it can't be class varible.because i didn't make it as a static?
Embla Tingeling
Ranch Hand

Joined: Oct 22, 2009
Posts: 237
anarkali perera wrote:it can't be class varible.because i didn't make it as a static?


That's right. If you make it static then there will be one array only, available to all objects of the class. If you make it non-static like now, then every object will have an array of its own.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36453
    
  15
I think the posh name for such a member variable is an instance field.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: where is the array going to created
 
Similar Threads
Serialization
reference to same object..
Iterator confuson
construct 2 dimensional array
is this correct way of implimenting comparable interface