Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Can Somebody tell me that how can i use "abstract" with OOP concept in JAVA??Can give any examples??? eg.if i'm straight forward using the variables from the database,then how can i still using the "abstract" concept?? Examples plz....

Hi!
The keywork abstract is to define a class or methods within a class that has no implementation.
This is used for inheritance where the abstract method or class have to be implemted when inherited.
A classical example of inheritance is the shape class.
The shape is an abstract entitity, a shape is just a shape.
but all shapes have common attributes, such as a center, the abillity to be rotated, the area, etc.
All shapes define this operations differently , hence they need different implementations. e.g. a circle calculates it's area differently than a square.
This is where abstract comes in.
If a method is defined abstract
in the base class it has to be redefined,
in it's childclasses.Not sure what you mean by using variable from a database..
/Marcus

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |