• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Simple Question regarding Abstract class

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you have a private variable in an abstract class?
also Can you have a static variable in an abstract class? and why?
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
jo sim
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you instantiate an abstract class indirectly if not directly and if so how?
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can instantiate a concrete subclass of an abstract class.
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An abstract class will be instanciated as part of the object creation process of any final class that extends it.


Give it a spin
 
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic