answersLogoWhite

Top Answer
User Avatar
Wiki User
Answered 2010-03-10 09:52:34

Any class which has one or more abstract methods is called an abstract class. But in the normal class we can't have any abstract methods.

We cannot create an object for the abstract classes.

When we inherit the abstract class we should implement the abstract method which we inherit.

567
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Related Questions


An abstract class can have a combination of abstract methods and normal methods. Interfaces cannot implement any methods themselves, all have to be abstract. Other classes can extend only one class (abstract or not), but can implement as many interfaces as they want.


If a class has one abstract method ,the class has to be an abstract class.Methods can be implemented in abstract class.Whereas a interface is like a abstract class...the only difference being that the methods are never implemented in Interface.


A final class cannot have any subclasses. An abstract class cannot be instantiated unless it is extended by a subclass.


Abstract class is built to promote inheritance whereas a final class is built to avoid inheritanceAn Abstract class can be extended by another class whereas a final class cannot be extended


Normal variables or static variables are declared and use in class but abstract class had only static variables. You have declare and define the methods in class. But abstract class only allow for method declaration only. The abstract class like interface.


Assume a "simple" class be a class without the keyword "abstract".You cannot create an instance of an abstract class. An abstract class is intended to be inherited from (to be extended or derived from).A "simple" class is a class that an instance can be created from (via new operator)


Some difference between an interface and an abstract class are: a. All variables in an interface are public, static and final but that is not the case in abstract classes b. An abstract class can have both abstract and concrete methods but an interface cannot have concrete methods c. An abstract class can extend other classes and implement interfaces, while an interface can only extend other interfaces.


An abstract method is one that is declared, but not implemented. That is, you have an empty method, without the details (the commands in the method). It is meant to be completed in a derived class.


A more prcise description of difference is as follows.... an interface is a specification of a set of methods that the implementation class must adhere to, while an abstract class is indeed an implementation class albeit a class that is not concrete, i.e., one cannot directly instantiate an abstract class.


Association class is describing the relationship between classes. An abstract class is just 1 class, provides some abstraction behaviors that may be (but do not have to) derived, overridden from.


abstract class no defination used by derieved class where virtual base class is defination that can be overriden later on


Abstract classes are classes that can't be instantiated directly. In other words, you are meant to create subclasses, which you instantiate.


In general programming terms, a concrete class is one which can be instantiated, while an abstract class can only be instantiated via a fully implemented subclass.


There is no difference with method declaration and implementation between abstract and non-abstract classes. You do the exact same thing when writing a concrete method in either an abstract or non-abstract class.


Below is the main difference between the 3 components:Concrete class - Provides implementation for all its methods & also for methods from extended abstract classes or implemented interfacesAbstract class - Does not provide implementation for one or more of its methodsInterface - Does not provide implementation for any of its methods


All the methods declared inside an Interface are abstract. Where as abstract class must have at least one abstract method and others may be concrete or abstract. In Interface we need not use the keyword abstract for the methods.


The difference are:An abstract class can have methods that actually have code inside them whereas an Interface cannot (An Interface can be thought of as a 100% pure abstract class)All variables in an Interface are public, static, final whereas that is not the case in Abstract classes


We can't instantiate both interfaces and abstract classes.The only one difference between them is that an interface can't contain concrete(fully defined) methods where as an abstract class may contain them.An abstract class not necessarily contain abstract methods. we can make a class as abstract class even it does not has any abstract methods.When there is a need to write both abstract and concrete methods in a single unit we have to use an abstract class instead of an interface since an interface cant contain concrete methods.All the fields(or properties) of an interface are by default 'static final' even when you don't mention explicitly. And all methods are 'public abstract'.But in an abstract class we can have any type of fields and methods.


You can't put an abstract method (pure-virtual method) in a normal class because the normal class would become abstract itself. Only non-abstract classes can be physically instantiated as objects, and only if they fully implement all the abstract methods inherited from their base classes.


//We Declare an abstract class as-abstract class Car{}//Example of an abstract methodabstract void hondaCity(); //no method body and abstract//Example of Abstract class that has an abstract methodabstract class Car{abstract void run();}class HondaCity extends Car{void run(){System.out.println("runs smartly");}public static void main(String args[]){Car obj = new HondaCity();obj.run();}}//OUTPUT will be-runs smartly


abstract is keyword this is used for define abstract methods and abstract classes.abstract method means if you want define a method with out any body at that time you should define a method with abstract keyword. EX:public abstract int add() { } if you want define a class with abstract method must and should you define a class will be abstract class. Abstract EX:abstract class abc { abstract methods ------------ non abstract methods ---------------- } you can define abstract as well as non abstract methods in abstract class. in normal class you can define only normal methods only. you can't acess the methods which are in the abstract class from the same clss.by child class only you can acess the methods which are in abstract class. if you want to inherit abstract class must and should you have to define abstract methods which are in abstract class. Interface ----------:- interface is also like a clss.in interface you have to define only abstract methods only.you can't define normal methods in interface. EX: interface abc { abstract methods } by inharitance only you can acess the methods what are in the interface through the class.


An interface can only have abstract methods or constants in it. A class can have both that and everything else in Java.


Some differences are:An abstract class can have code for one or more methods but an interface cannotAll variables in an interface are public static and final but in an abstract class it is notAbstract classes are faster than interfaces


Abstract class is to define "IS_A..." Interface is to define "Behave like ..." (not necessary to be a ...") An abstract class if with all public abstract methods may look just like an interface. An abstract class may also provide some implementation of those APIs (public methods), while an interface is to decouple (separate) the intend from the implementation


An abstract class(or classes) can't have a constructor and hence you cannot invoke the constructor of the class (for example, you can instantiate an abstract class and hence you cannot call the constructor of an abstract class).



Copyright ยฉ 2021 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.