wood burning stoves 2.0*
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: 3817

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 ;)
 
Consider Paul's rocket mass heater.
 
subject: instance variables of Abstract Classes
 
Similar Threads
Instance Variable In abstarct classes
Interface and abstract
How To Placed variables in Abstract classes
Abstract class & Interface
How To Placed variables in Abstract classes