wood burning stoves 2.0*
The moose likes Java in General and the fly likes what is the use of abatraction? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "what is the use of abatraction?" Watch "what is the use of abatraction?" New topic
Author

what is the use of abatraction?

pardha saradhi74
Greenhorn

Joined: Jul 07, 2001
Posts: 9
Hi I am still confusing with abstraction?
What is the use of abstraction and where can we use it?
Please if any one having good references please
let me know
thanking you inadvance
Saradhi
Irene Loos
Ranch Hand

Joined: Apr 15, 2002
Posts: 78
Pardha,
You can use abstraction to create abstract class that has no use by itsef exept as it could be sublassed later to create concrete class - child. Consider a car in general is abstract class that has some behavior (4 wheels, moves when you push accelerator, stops, etc.) This is an abstract car. Now if you think about Nissan Maxima this is more concrete car with attributes that might be only available for this car. But all of the attributes and methods of class Car are available for class Nissan Maxima.

For more info you can read http://java.sun.com/docs/books/tutorial/java/javaOO/abstract.html
Hope this will help.
Irene


Irene Loos
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
An abstract class is used when you want to provide some implementation but not all. Other classes can subclass the abstract class, get the implemetation it already has, and then add their own implementation for the missing pieces.
Let's take an example from the AWT. The Component class is the abstract parent of all AWT component objects. It provides basi component functionality such as setting background and foreground colors, setting the bounds, adding and removing common listeners etc. But you would never want to actually instantiate a Component. All the children of Component get all the Component functionality for free. They can then provide whatever additional functionality they need.
It might be interesting to note that although Component is abstract it has no abstract methods!


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is the use of abatraction?
 
Similar Threads
abstraction
Encapsualtion
abstraction
abstraction
Abstraction