aspose file tools*
The moose likes Beginning Java and the fly likes instance variables of Abstract Classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "instance variables of Abstract Classes" Watch "instance variables of Abstract Classes" New topic
Author

instance variables of Abstract Classes

Rajat Sarkar
Greenhorn

Joined: Sep 07, 2008
Posts: 18
Abstract classes can have instance variables.But abstract classes can't never be instantiated.So where do the instance variables live in?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

Rajat Sarkar wrote:Abstract classes can have instance variables.But abstract classes can't never be instantiated.So where do the instance variables live in?


Abstract classes can have certain method implementations in it which are not abstract. Those methods can use those variables.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
in addition the instance variables could be used by the concrete class that extends the abstract class, for example if you have an abstract class named Person and you specify that it has an instance variables named Head, then if a class named Employee extends Person, it can acceess the head instance variable.





(peace)


Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
hope you got my point ;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: instance variables of Abstract Classes