Quantcast
answersLogoWhite
notificationBell

Top Answer
User Avatar
Wiki User
Answered 2012-05-14 04:46:41

1>Abstract class is use to extends the only one class not more then one class

2>Abstract class can contant construct

2>Abstract class can contant static block and non-static block both

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

Your Answer

Still Have Questions?

Related Questions

What is abstract data type in?

Abstract is the data type which can be used at method and class level... The abstract keyword which we used at method level makes that method as abstract means not giving implementation for that method.. the abstract keyword which used at the class level , restrict developers not to create the object of that class.


What is the meaning of abstract in java?

The keyword abstract is used to signify a class which does not offer the method definition for one or more methods in the class. A fully abstract class is equivalent to an interface.


Abstract in java?

An abstract in java is used to specify that the class/function is not yet complete. When a class in declared as abstract it means that it is not meant to be instantiated (you can't create variables of that type). This is because they are meant to be more of a guideline for other classes. When a class extends an abstract class it must either define all of the abstract methods from the abstract class or it must also be declared as an abstract class itself.


What is the benefit of using abstract class?

Abstract classes are generally used where you want an amount of behavior to be used by the class that extends the abstract class while at the same time giving options to the child class to provide a certain amount of behavior itself.


What can be declared in an abstract class?

Abstract classes are to be extended until to a concrete class.Can have both abstract & non abstract methods.An Abstract class can not be instantiated.A non abstract class can be extended to an abstract class.If At least one abstract method present in a class then that class must be abstract.abstract & final modifiers can never be together.abstract classes can have both abstract methods & non abstract methods.


Can an abstract class inherit from another abstract class in c plus plus?

Yes an abstract class can inherit from another abstract class but all the methods of the base abstract class must be abstract.


What is purpose of creating an abstract class in java?

Abstract classes are generally used where you want an amount of behaviour to be used by the class that extends the abstract class while at the same time giving options to the child class to provide a certain amount of behaviour itself.


What is an abstract class in java?

An Abstract class is a special kind of class that cannot be instantiated. It has one or more methods which are not implemented in the class. These methods are declared abstract and they do not contain any code inside them.Ex:abstract class Parent {public abstract String getSon();public abstract String getDaughter();........//More methods that contain specific behaviour/code in them}The above is an abstract class "Parent" that has a lot of functionality but it has declared two abstract methods which have no code inside them. Any class that has one or more abstract methods has to be abstract. This abstract class cannot be instantiated.i.e., the below piece of code will not work. The code will not even compile.Parent object = new Parent();Purpose of Abstract Classes:Abstract classes are generally used where you want an amount of behaviour to be used by the class that extends the abstract class while at the same time giving options to the child class to provide a certain amount of behaviour itself.


How do you declare class as an abstract?

//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


What happens if an abstract modifier is applied to class. Explain?

The classes which have one or more abstract methods are abstract. To declare a class as abstract, use the abstract keyword in front of the class keyword, before the class declaration. Abstract classes cannot be instantiated. Similarly the new keyword cannot be used to create an object of the abstract class. Remember that the constructors and static variables cannot be declared as abstract. Any subclass of an abstract class must either implement all of the abstract methods in the superclass or be itself declared abstract.


Is abstract data type a structured data type?

Abstract is not a datatype but a modifier. Abstract can be used in 2 places: Methods: If a method is termed abstract it means that the current class does not provide an implementation for this method and the first concrete subclass will do the same. Classes: Any class that has one or more abstract methods has to be abstract. If a class is abstract it means that the implementing class has to provide an implementation for one or more of the abstract methods of this class.


Abstract keyword in java?

Abstract keywordused for method declaration declares the methods without implementations. Abstract class in java have abstract methods that is not implemented in abstract class, but implemented in subclasses in java program. If the class in java program is not required to get instantiated than that class use the abstract keyword but this class rather is available for other classes to extend by other classes. Abstract keyword will be used in method declaration to declare that method without providing the implementation in that java program. In other words we can say that, it formally unfinished class as well as method, that marked with the help of keyword abstract. Defining abstract is a way of preventing someone from instantiating a class that is supposed to be extended first. In java program abstract class is deliberately missing similar to like an interface which will missing all method bodies in the program. Abstract class provides a way to extend an actual class. We will not use new on abstract classes but will use abstract references in the java program, that always point to objects of the class that extends an abstract class. In java program for practical use of an abstract class, we will define a non-abstract class that extends an abstract one. This will use any of the inherited non-abstract methods. Most of the time abstract class may extend another abstract class. In that condition it need not implement all in the non-abstract methods. An abstract keyword used both on classes and methods. In case of class declared with an abstract keyword may not be instantiated that is the only thing that abstract keyword doing.


What is purpose of An Abstract Class in java?

Abstract keyword used for method declaration declares the methods without implementations. Abstract class in java have abstract methods that is not implemented in abstract class, but implemented in subclasses in java program. If the class in java program is not required to get instantiated than that class use the abstract keyword but this class rather is available for other classes to extend by other classes. Abstract keyword will be used in method declaration to declare that method without providing the implementation in that java program. In other words we can say that, it formally unfinished class as well as method, that marked with the help of keyword abstract. Defining abstract is a way of preventing someone from instantiating a class that is supposed to be extended first. In java program abstract class is deliberately missing similar to like an interface which will missing all method bodies in the program. Abstract class provides a way to extend an actual class. We will not use new on abstract classes but will use abstract references in the java program, that always point to objects of the class that extends an abstract class. In java program for practical use of an abstract class, we will define a non-abstract class that extends an abstract one. This will use any of the inherited non-abstract methods. Most of the time abstract class may extend another abstract class. In that condition it need not implement all in the non-abstract methods. An abstract keyword used both on classes and methods. In case of class declared with an abstract keyword may not be instantiated that is the only thing that abstract keyword doing.


What is an abstract factory class?

An abstract factory class is a class which has an abstract method to create an object.


Is it necessary to implement all the methods of abstract classes in derived class?

Yes - It is Necessary to implement all methods of the abstract class in your class - If you want a concrete class that can be instantiated. If you dont plan on implementing all methods, then you have to declare your current class too as Abstract. Abstract classes are generally used where you want an amount of behaviour to be used by the class that extends the abstract class while at the same time giving options to the child class to provide a certain amount of behaviour itself.


What is abstract and interface?

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.


What is the difference between Virtual Base Class and Abstract Class in c plus plus?

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


What is an abstract class Write the syntax Declare a pure virtual function in an abstract class?

an abstract class is nothing but class which contains both abstract and concrete methods for abstract class we r nt create object Syntax for pure abstract class is abstract class x { public void abstract y(); public void abstract z(); public void abc() { }


What is the difference between abstract class and normal class?

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.


What is abstract class in Java?

a abstract class is class which has a abstract method which means a method does not its own body.


Why abstract classes should be used in java?

An abstract class can never be instantiated. Its sole purpose or rather mission in life is to be extended (subclassed).Purpose of Abstract Classes:Abstract classes are generally used where you want an amount of behaviour to be used by the class that extends the abstract class while at the same time giving options to the child class to provide a certain amount of behaviour itself.A Child Class extending the Abstract Class:public class Child extends Parent {public String getSon() {return "Sons Name";}public String getDaughter(){return "Daughters Name";}...... //Code specific to the Child class}


What is the use constructor in abstract class?

The constructor is used to initialize objects - to prepare them the moment they are created. This is the same in an abstract class as in any other class. The object will simply be created from a subclass of the abstract class, but a constructor may still be useful.


What is similarities between Abstract Class and Interface?

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.


What is abstract class and abstract method?

An Abstract method is one that has only a method declaration and no method definition. Similarly an abstract class is one that has one or more abstract methods. You can declare an abstract class or methods by using the keyword abstract in the class definition. Ex: public abstract class TestAbsClass { abstract void method1(); } Any class that extends this abstract class must provide implementation to the method "method1" or else it would have to be abstract as well.


Difference between abstract class and concrete class?

An Abstract class is a special kind of class that cannot be instantiated. It has one or more methods which are not implemented in the class. These methods are declared abstract and they do not contain any code inside them.Ex:abstract class Parent {public abstract String getSon();public abstract String getDaughter();........//More methods that contain specific behaviour/code in them}The above is an abstract class "Parent" that has a lot of functionality but it has declared two abstract methods which have no code inside them. Any class that has one or more abstract methods has to be abstract. This abstract class cannot be instantiated.i.e., the below piece of code will not work. The code will not even compile.Parent object = new Parent();Purpose of Abstract Classes:Abstract classes are generally used where you want an amount of behaviour to be used by the class that extends the abstract class while at the same time giving options to the child class to provide a certain amount of behaviour itself.A Child Class extending the Abstract Class:public class Child extends Parent {public String getSon() {return "Sons Name";}public String getDaughter(){return "Daughters Name";}...... //Code specific to the Child class}


Still have questions?

Trending Questions
Do potatoes have genders? Asked By Wiki User
Who was Anna Kreisling? Asked By Wiki User
Previously Viewed
Unanswered Questions
Does arsenio hall have ms? Asked By Wiki User