wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Fields in Java Api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Fields in Java Api" Watch "Fields in Java Api" New topic
Author

Fields in Java Api

Anurag Mishra
Ranch Hand

Joined: Jun 16, 2003
Posts: 121
Hi,
its a basic Question,
If we see the Java Api docs provided by sun
for java.util.Vector
In this there they have defined a protected field called
as "elementCount"
Can anyone just tell how i can use this.
say in a simple programm pls provide sample if possible.
thanks
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

The only time you would use this field is if you were writing a class that extended Vector and changed its behavior somehow, and in doing so, you needed to know that number of elements held by the Vector. Extending Vector isn't something you're likely to want or need to do.


[Jess in Action][AskingGoodQuestions]
Anurag Mishra
Ranch Hand

Joined: Jun 16, 2003
Posts: 121
thanks a lot,
Actually even i hadimported the java.util.vector class i was not able to use this field, later i came to know since its a protected field so we
must need to extend vector class to access this.
thanks a lot for ur reply.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Fields in Java Api