File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

where is the array going to created

 
anarkali perera
Ranch Hand
Posts: 237
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
anarkali perera
Ranch Hand
Posts: 237
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it can't be class varible.because i didn't make it as a static?
 
Embla Tingeling
Ranch Hand
Posts: 237
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic