This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes instantiation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "instantiation" Watch "instantiation" New topic
Author

instantiation

sandeep Talari
Ranch Hand

Joined: Dec 24, 2007
Posts: 63
can't we instatiate the abstract class or not...
some where i read that we can do but when i tried it its not working
can somebody help me
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2053
No, you can never instantiate an abstract class.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

You cannot directly instantiate an abstract class. However, you can instantiate a concrete subclass and upcast the reference to the abstract type. For example...


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: instantiation