Quantcast
answersLogoWhite
notificationBell
Java Programming

Abstract in java?


Top Answer
User Avatar
Wiki User
Answered 2010-12-13 22:48:27

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.

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

Your Answer

Still Have Questions?

Related Questions

Why you use abstraction in java?

1.Abstraction in Java allows the user to hide non-essential details relevant to user.2.Java has concept of abstract classes , abstract method but a variable can not be abstract


What is Abstract-Interface in java?

All interfaces are abstract.



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.


Can an abstract method be declared static in java?

No, Java will fail to compile: "illegal combination of modifiers: abstract and static"This is a rather odd error, since Java does allow you to override static methods.


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 has the author D S Malik written?

D. S. Malik has written: 'Java Programming' 'Java programming' -- subject(s): Java (Computer program language) 'Fundamentals of abstract algebra' -- subject(s): Abstract Algebra, Algebra, Abstract 'C++ Programming'


What is abstract in java?

an abstract class is something which is incomplete and you can not create instance of it for using it.if you want to use it you need to make it complete by extending it.an abstract method in java doesn't have body , its just a declaration.


Does abstract class contain the definition of non abstract method in java?

yes,abstract class can have non abstract methods,even it can have all non abstract method


Interface in java?

include all abstract method



When do you declare a method or class abstract in java?

when overriding of a class or a method is necessary, they can be declared as abstract


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 difference in use between interfaces and abstract classes in java?

While neither abstract classes nor interfaces can be instantiated in Java, you can implement methods in abstract classes. Interfaces can only define methods; no code beyond a method header is allowed.


How do you make a class in Java abstract?

By using the abstract keyword in the class declaration line. Ex: public abstract ClassName {} The Java compiler will force you to use the abstract keyword in the class declaration line if one or more methods in your class are abstract (no implementation) or if you have not provided implementations for one or more methods of an interface that you are implementing in your class definition. You cannot instantiate an abstract class.



Can abstract method be declared as final in java?

No. An abstract method must be overriden in an subclass. If the method is final then it can't be edited.


What is the advantage of using abstract class and methods in java?

This has to do with inheritance. An abstract method ensures that all inherited classes have such a method.


What are abstract class in java?

An abstract class is just like any other class in java just with a little difference; at least one of his methods is not implemented (a abstract method). For this reason abstract classes can not be instantiated (create a sample of this class), and his unique purpose is to be inherited an implemented by others classes. This is a sample of a abstract class: public abstract class MyAbstract{ public void normalMethod(){//Do something} public abstract void abstractMethod(); }


What is interface in java?

Interface is collection of abstract methods which has only declaration and no implementation


What kind of constructs can be declared in a Java interface?

Constants and abstract methods. That's it.


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.


Differentiate Java Abstract Class and Java Interface?

Differences:Abstract class can also contain method definitions but an interface can contain only declarationsAll variables in an interface are by default public static and final whereas in Abstract class it is notAn interface can be considered as a pure abstract class that contains no method implementations and contains only declarations.


Full form of Java?

NO full form of java. just it stands for hot and aromatic coffee.It is just an abstract name that the devlopers gave.


What are the differences between an abstract class and an interface in java?

An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class. Source: Refer Related Links


Still have questions?

Trending Questions
Previously Viewed
Abstract in java? Asked By Wiki User
Unanswered Questions
Is rice pudding ok for dogs? Asked By Wiki User
Why we require Microsoft paint? Asked By Wiki User
What is saging ternate? Asked By Wiki User