Using abstract class and Interface

Using abstract class and Interface

when to use abstract class and when to use interface? give me answer with real time scenario?

View Answers

February 28, 2008 at 7:44 PM

Hello,

When to Use Interfaces
Two Important Differences Between Interfaces and Abstract Classes

* Interfaces provide a form of multiple inheritance. A class can extend only one other class.
* Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc.

Interface or Abstract Class

* These two differences usually direct the choice.
* If multiple inheritance is important or even useful interfaces are used.
* Abstract class lets you define some or all of the implementation.
* Any major class you expect to be extended should be an implementation of an interface.

Thanks









Related Tutorials/Questions & Answers:
Interface and Abstract class
interface should be implemented using keyword 'implements'; A Java abstract class should... and Abstract class? Give some example   Difference Between Interface and Abstract Class 1)Main difference is methods of a Java interface are implicitly
Interface and Abstract class
Interface and Abstract class  hello,, Can some body tell me what is the difference between an Interface and an Abstract class?   hi,ADS_TO_REPLACE_1 Very Good Question Abstract class is a class which contain one
Advertisements
Abstract class and interface in Java
Abstract class and interface in Java  What is the difference between abstract class and interfaces in Java?   Differences between an interface and an abstract class: At the same time multiple interfaces can
Interface vs abstract class
Interface vs abstract class  Hai, Is there any possible to defining abstract methods in Interface
abstract class and interface - Java Beginners
? when should we use an abstract class? when should we use interface instead...() { System.out.println ("Moo! Moo!"); } } Why not declare an abstract class as an interface.... For difference between interface and abstract class visit to : http
Interface Vs Abstract Class
Interface Vs Abstract Class       There are three main differences between an interface and an abstract..., an interface is equivalent to a fully abstract class (a class with only public abstract
Difference between abstract class and an interface
Difference between abstract class and an interface The difference between abstract class and interface is one of the most popular question in the interview... between abstract class and interface in java. Abstract class is a class
What are the difference between abstract class and interface?
What are the difference between abstract class and interface?  What are the difference between abstract class and interface
Abstract class and Interface - Java Magazine
Abstract class and Interface  Dear Sir, Please anyone help me........I wane exact difference between Abstract class and Interface.what... abstract class AbstractExample { public AbstractExample(){ System.out.println
Uses of abstract class & interface - Java Beginners
Uses of abstract class & interface  Dear sir, I'm new to java. I knew the basic concepts of interface and the abstract class. But i dont... classes from different types of hierarchy. Abstract Class: Any class
Using Abstract Class
Using Abstract Class      ... class. This class must be inherited. Unlike interface the abstract class may... method should be abstract. We can't instantiate the object of the abstract class
where exactly we use interface and where abstract class?
where exactly we use interface and where abstract class?  what is the use of interface over abstract class? and where we should use interface and where abstract class
Abstract and Interface
abstract class should be extended using keyword 'extends'. 5)An interface can... for using interface? Why we use interface instead of abstract? What... Interface and Abstract Class 1)Main difference is methods of a Java interface
Java Abstract Class
Java Abstract Class       An abstract class is a class that is declared by using the abstract keyword... an abstract class. Which helps us to organize our classes based on common methods
Real Time Example Interface and Abstract Class - Java Beginners
Real Time Example Interface and Abstract Class  Hi Friends, can u give me Real Time example for interface and abstract class.(With Banking Example
Why does Java provide both abstract class as well as interface
Why does Java provide both abstract class as well as interface  why does java have both abstract class as well as interface? what is the need or importance of having both
Abstract and Interface
Abstract and Interface  what is the difference between Abstract and Interface accurateatly
abstract class
abstract class   Explain the concept of abstract class and it?s use with a sample program.   Java Abstract Class An abstract class is a class that is declared by using the abstract keyword. It may or may not have
Abstract class
Abstract class  Can an abstract class be final
Abstract class
Abstract class  what is an Abstract class
abstract class
abstract class  Can there be an abstract class with no abstract methods
Java Abstract Class Example
using 'abstract' keyword. An abstract class may contain abstract...Java Abstract Class Example In this section we will read about the Abstract class. Abstract class in Java is a class which is created for abstracting
Abstract Class in Java
Abstract class in Java is a class that is declared using abstract keyword. It cannot be instantiated but can be extended into subclass. Abstract class cannot be instantiated means that new instances of an abstract class cannot
Abstract class
Abstract class  j   An Abstract class is a base class which... with an abstract keyword. For more information, visit the following links: http://www.roseindia.net/help/java/a/java-abstract-class.shtml http://www.roseindia.net/java
abstract class
abstract class  abstract class AbstractClass{ } is possible and compile the class or any compile time error occur tell me the answer Blockquote
abstract class
abstract class  what is abstract class .why we use it or what is the need of this class?   Abstract class is like base class which contains abstract method and cannot instantiated.   Please go through
Abstract class
Abstract class  Calendar cal=Calendar.getInstance() We know that Calendar is an abstract class so it can't be instantiated. So how we can say that cal is an instance of Calendar??? Beginner Question I suppose. Thanks in advace
Abstract class,Abstract methods and classes
interface are abstract by default. Abstract method provides the standardization...(); Abstract Class ADS_TO_REPLACE_2 In java programming language, abstract classes are those that works only as the parent class
code for abstract class
code for abstract class  code for abstract class
What is an abstract class?
What is an abstract class?  What is an abstract class
Why Abstract Class?
Why Abstract Class?  What is the use of Abstract Class if it has Zero Abstract methods
Why Abstract Class?
Why Abstract Class?  What is the use of Abstract Class if it has Zero Abstract methods
Abstract class and abstract method
be private because it defined in the other class. An abstract methods cannot... points about abstract methods are as following An abstract class may or may... also. An abstract class cannot be instantiated so it need to be a sub class
Java abstract class
Java abstract class  Can an abstract class be final
variables and methods declared in abstract class is abstract or not
variables and methods declared in abstract class is abstract or not  variables and methods declared in abstract class is abstract
Explain final class, abstract class and super class.
. An abstract class is a class that is declared by using the abstract keyword. It may...Explain final class, abstract class and super class.  Explain final class, abstract class and super class.   Explain final class, abstract
Diff between Runnable Interface and Thread class while using threads
Diff between Runnable Interface and Thread class while using threads  Diff between Runnable Interface and Thread class while using threads  ... to Runnable Interface. 3)Using Runnable Interface, you can run class several
Diff between Runnable Interface and Thread class while using threads
Diff between Runnable Interface and Thread class while using threads  Diff between Runnable Interface and Thread class while using threads  ... to Runnable Interface. 3)Using Runnable Interface, you can run class several
abstract class and overriding - Java Beginners
abstract class and overriding  what is the difference between abstract class and overriding? Interface? Give some example program?   Hi..._value(); } } Difference between abstract class and interface
abstract class - Java Beginners
abstract class  what exactly is abstract class and in which cases its... inherited from the abstract class (base class). Abstract classes... . e.g. abstract class A{ public abstract abs_value(); void show
Abstract class - Java Beginners
Abstract class  Why can use abstract class in java.?when abstract class use in java.plz Explain with program.   abstract class abs{ public void display(){ } public abstract void display1(); } public class win
why we use abstract class in java?
why we use abstract class in java?  what is the the purpose of abstract class.Give example when to use abstract and when use interface
Write Full concept of abstract class
Write Full concept of abstract class  Abstract class
what's the purpose of constructor in abstract class?
what's the purpose of constructor in abstract class?  what's the purpose of constructor in abstract class
What is an Abstract Class and what is it's purpose?
What is an Abstract Class and what is it's purpose?   Hi, What is an Abstract Class and what is it's purpose? Thanks
Can a abstract class be declared final?
Can a abstract class be declared final?   Hi, Can a abstract class be declared final? Thanks
Interface in java with example
of a class. Interface is a collection of abstract methods. Interface has only static constant and abstract method. We can only implement a class and extended... all method in interface abstract and public. Multiple inheritance allows
abstract class - Java Interview Questions
abstract class  Explain the abstract class and abstract method...://www.roseindia.net/java/master-java/abstract-class.shtml http://www.roseindia.net/help/java/a/java-abstract-class.shtml Hope that it will be helpful for you. Thanks
Java-Abstract Class - Java Beginners
Java-Abstract Class  Can a abstract class have a constructor ?When would the constructor in the abstract class be called ? Please give me with good...; Hi Friend, Yes. But Abstract class constructors will be called when its
Can a abstract class be defined without any abstract methods?
Can a abstract class be defined without any abstract methods?   hi, Can a abstract class be defined without any abstract methods? thanks

Ads