wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Simple Question regarding Abstract class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Simple Question regarding Abstract class" Watch "Simple Question regarding Abstract class" New topic
Author

Simple Question regarding Abstract class

jo sim
Ranch Hand

Joined: Apr 24, 2006
Posts: 37
Can you have a private variable in an abstract class?
also Can you have a static variable in an abstract class? and why?
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Yes and Yes

An Abstract class will be part of a final class and as such can do everything a final class can with the exception of being instanciated directly.


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
jo sim
Ranch Hand

Joined: Apr 24, 2006
Posts: 37
can you instantiate an abstract class indirectly if not directly and if so how?
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
You can instantiate a concrete subclass of an abstract class.
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
An abstract class will be instanciated as part of the object creation process of any final class that extends it.


Give it a spin
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
@jo

pure curiosity - why don't you try yourself? don't get me wrong, it's good to post questions here, but in order to find out the answer to a "can i ..." question, trying out is perfectly okay.

if it comes to the "why..." part, people will be happy to help...

many greetings,
jan
jo sim
Ranch Hand

Joined: Apr 24, 2006
Posts: 37
Thanks for helping me out I wanted to know if there was a way to instantiate the abstract class but i guess there is no way. I wanted to know what is the meaning of explicit and implicit object casting? I cant seem to find resources on it can you provide me a link?
thanks for your help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple Question regarding Abstract class