This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes but what useful of them at real time ? 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "but what useful of them at real time ?" Watch "but what useful of them at real time ?" New topic
Author

but what useful of them at real time ?

moneer mohammed
Ranch Hand

Joined: Feb 18, 2005
Posts: 66
Please can any one tell me when I need use abstract class and interface I know what different but what useful of them at real time when I have project


java_just
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
As Java does not support multiple inheritance, when you need to have a class (or abstract class) that contains various features, you have to use interfaces.

Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
moneer mohammed
Ranch Hand

Joined: Feb 18, 2005
Posts: 66
ok but agian i need to impelement all the methods so no usefull
please give me example
deshdeep divakar
Ranch Hand

Joined: Apr 19, 2004
Posts: 91

Hi,
Nicolas is right,When u have to use an abstract
class the methods in abstract class have to be
marked abstract,and when this class is subclassed,
subclass need to provide the relevant implementation for
each abstract method,while interfaces methods in Interfaces
are abstract by virtue of their declaration,and
should not be declared abstract.Also an Interface
is abstract by definition and therefore cannot
be instayiated.it should not be declared abstract.


"Do not be afraid of going slow, be afraid of standing still"
Nischal Tanna
Ranch Hand

Joined: Aug 19, 2003
Posts: 182
Originally posted by Nicholas Cheung:
As Java does not support multiple inheritance, when you need to have a class (or abstract class) that contains various features, you have to use interfaces.

Nick



Wow nick what a long list of degrees ?..a studious guy i shud say


Thnx
 
jQuery in Action, 2nd edition
 
subject: but what useful of them at real time ?
 
Similar Threads
Java RTS! Applications?
how to retrace an unknown NullPointerException
difference between arraylist and linkedlist?
summer internships
SCEA - exam looses its prestige