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 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

Fields in Java Api

Anurag Mishra
Ranch Hand

Joined: Jun 16, 2003
Posts: 121
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.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

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.
I agree. Here's the link:
subject: Fields in Java Api
It's not a secret anymore!