Compare an abstract class and an interface , JAVA Programming

You want the base class to represent only an interface for its derived classes. That means, you don't want anyone to actually instantiate an object of the parent class. You only want to upcast to it so that its interface may be used. This is accomplished by building that class abstract using the abstract keyword. If anyone tries to build an object of an abstract class, the compiler saves it.

 

The interface keyword makes this concept of an abstract class a step further by preventing any function or method implementation at all. You can only define a method or function but not give the implementation. The class, which is adding the interface, should give the actual implementation. The interface is a commonly and very useful used aspect in OO design, as it gives the implementation and separation of interface and actives you to:

 

1. Use similarities among unrelated classes without artificially forcing a class relationship.

2. Define methods that one or more classes are expected to implement.

3.  Reveal an object's programming interface without revealing its basic implementation.

4. Model multilevel interface inheritance in Java, which gives some of the benefits of full on multiple inheritances, a feature that some object-oriented languages support that allow a class to have more than one parented class.

 

 

155_Untitled.png

Posted Date: 7/25/2012 1:30:33 AM | Location : United States







Related Discussions:- Compare an abstract class and an interface , Assignment Help, Ask Question on Compare an abstract class and an interface , Get Answer, Expert's Help, Compare an abstract class and an interface Discussions

Write discussion on Compare an abstract class and an interface
Your posts are moderated
Related Questions
Project Requirements • Create your own online store Web site, selling products of your choice. • Create pages that allow you to search and buy available products, as well as add,

I am requiring webcam software integrated into my site I have website and I am wanting webcam software integrated into my site the company I have found doesn't offer support in

i want a full program with test about the following: linkedComputers: We will assume that a number of methods are required. These are specified below. String getComputerName() ret

what is the code for page replacement algorithms in nachos os

The == gives true, if the variable reference points to the similar types of object in memory. That is a " shallow comparison ".   The equals () - gives the results of run

What are object/relational mapping integration module? Ans) Spring also supports for using of an object/relational mapping (ORM) tool over straight JDBC by giving the ORM module

Spring configuration file is an XML file. This file having the classes information and defines how these classes are configured and introduced to each other.

Suppose that: A is the set of characters in the string "pellet"; B is the set of characters in the string "teller"; C is the set of characters in the string "pertinent"; a


1. RUP is relying on a few important principles and philosophies like planning ahead, knowing where the process is capturing and heading the project in extensible and storable mann