aspose file tools*
The moose likes Beginning Java and the fly likes why we need to declare a class abstract?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "why we need to declare a class abstract??" Watch "why we need to declare a class abstract??" New topic
Author

why we need to declare a class abstract??

Puneet Mittal
Ranch Hand

Joined: Dec 18, 2007
Posts: 45

hi please tell me what is the need of declaring a class abstract???
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40041
    
  28
I presume you have read this FAQ? You don't "need" to declare a particular class abstract, but there are occasions when you want a "place" in your inheritance hierarchy where you don't want anybody creating instances, or you might have methods which will have such variability that you want them abstract too.
ExampleNow, some behaviour of buses and cars might be the same, some might be different, but you don't want any "Vehicle" objects. So you would probably declare Vehicle abstract. I think, you write the name of abstract classes in italics in a UML diagram.
camilo lopes
Ranch Hand

Joined: Aug 08, 2007
Posts: 202
when you want to leave that a subclass implements the methods abstract.


Brazil - Sun Certified Java Programmer - SCJP 5
http://www.camilolopes.com/ About Java - Update every Week.
Guide SCJP - tips that you need know http://blog.camilolopes.com.br/livrosrevistaspalestras/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why we need to declare a class abstract??