Quantcast
answersLogoWhite
notificationBell

Top Answer
User Avatar
Wiki User
Answered 2010-01-26 06:36:24

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

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

Your Answer

Still Have Questions?

Related Questions

Difference between abstract and final class?

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


What is the difference between a interface and abstract class?

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.


What is the difference between abstract and interface?

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


What is difference between abstract class and interface in core java give brief answer with example?

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


Can you define a class as final and abstract both?

Yes, a class can be defined as final and abstract also.


What is the difference between an Abstract class and Interface?

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.


Can you declare final method in abstract class?

Yes, you can declare a final method in an abstract class. However, that method cannot be abstract itself.


Is a final class can have instances?

Yes, you can make an instance of a final class. You can't have an instance of an abstract class.


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 you have a final abstract class?

No. The abstract keyword means that you cannot instantiate the class unless you extend it with a subclass. The final keyword means that you cannot create subclasses of that class.Combining them would lead to an unusable class, so the compiler will not let this happen.


Difference between final goods and intermediate goods?

difference between final and intermediate goods difference between final and intermediate goods


What is the abstract keyword in Java?

The abstract keyword is used to denote abstract classes and abstract methods in Java.An abstract method is a method which is defined, but not implemented:public abstract void doStuff();An abstract class is a class which contains one or more abstract methods*, and which cannot be instantiated directly. All subclasses of an abstract class must implement the abstract methods.* Note that abstract classes can include no abstract methods, but this rather defeats the purpose of using an abstract class.The quintessential example of an abstract class is the Shape class.// Definition of our abstract classpublic abstract class Shape {// Notice how we can actually declare and implement variables and methods.// This is what differentiates between an abstract class and an interface.// The location of this shapeprivate double x,y;// Change our location - all subclasses will have this by defaultpublic void moveTo(final double newX, final double newY) {x = newX;y = newY;}// Definitions of our abstract classes.// All classes which extend from Shape must implement these.public abstract double getArea();public abstract double getPerimiter();}// Definition of our concrete example classpublic class Rectangle extends Shape {// Beyond the x,y location of Shape, Rectangle must have width and heightprivate double width, height;// Implement abstract methodspublic double getArea() {return width * height;}public double getPerimiter() {return width + width + height + height;}}


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.


What is the difference between abstract classes and interfaces?

Comparison between an Abstract Class and an Interface:While an abstract class can define both abstract and non-abstract methods, an interface can have only abstract methods. Another way interfaces differ from abstract classes is that interfaces have very little flexibility in how the methods and variables defined in the interface are declared. These rules are strict:• All interface methods are implicitly public and abstract. In other words, you do not need to actually type the public or abstract modifiers in the method declaration, but the method is still always public and abstract. (You can use any kind of modifiers in the Abstract class)• All variables defined in an interface must be public, static, and final-in other words, interfaces can declare only constants, not instance variables.• Interface methods must not be static.• Because interface methods are abstract, they cannot be marked final, strictfp, or native. (More on these modifiers later.)• An interface can extend one or more other interfaces.• An interface cannot extend anything but another interface.• An interface cannot implement another interface or class.• An interface must be declared with the keyword interface.You must remember that all interface methods are public and abstract regardless of what you see in the interface definition.


Write EBNF descriptions for A java class definition header statement?

® {} class [extends class_name] [implements {, }] ® public | abstract | final ® {} class [extends class_name] [implements {, }] ® public | abstract | final


Abstract class vs interface?

Comparison between an Abstract Class and an Interface:While an abstract class can define both abstract and non-abstract methods, an interface can have only abstract methods. Another way interfaces differ from abstract classes is that interfaces have very little flexibility in how the methods and variables defined in the interface are declared. These rules are strict:


What is the difference between the pigs and the other animals?

The difference is: your motha. Final answer.


What is the relationship between inheritance methods and the keyword final?

They are inversely related. That is: If you declare a method as final you cannot overridden in the child class If you declare a class as final you cannot inherit it in any other class.


Can an abstract class be final?

Short answer: no. If the purpose of creating such a beast is to prevent the class from being instantiated, use a private no-arg constructor. abstract = means the class cannot be instantiated except through a sub-class. final = means the class cannot be sub-classed. Seems the only reason to want to do this is to create a "utility" class - only static methods that other classes will use, maybe as a way of collecting common code in one spot. This is a very common practice, and utility classes should be declared final with private constructors.


What is difference between intermediate and final goods and services?

The difference between an intermediate good and service and final goods and service are that intermediate goods and service are used to make final goods and service(:


What is the difference between inuyasha and inuyasha the final act?

there us no really big difference between them inuyasha final act is basicley the closing of the whole anime


What are the difference between private variable and final variable?

A private variable is one that is accessible only to the current class and cannot be accessed by any other class, including the ones that extend from it. A final variable is one that cannot be modified once it is initialized and assigned a value.


Difference between final keyword and final method?

The final keyword can be used to modify a class, method, or variable.When used on a variable, it means that variable cannot be changed once set.When used on a method, it means that no subclasses may override that method.


Why can't declare construtor as a static final abstract?

Because of the following reasons:static - If a constructor is static, an object instance cannot invoke it to initialize itself (Because static members are not linked to an object)abstract - because an abstract class cannot be instantiated and hence it will not have a constructor. If you make a concrete class's constructor abstract - it cannot be instantiated. eitherways it makes no sensefinal - a constructor cannot be final (thats the way java is designed)


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.


Still have questions?

Trending Questions
Best foods for weight loss? Asked By Wiki User
How to lose belly fat? Asked By Wiki User
Unanswered Questions
Saan nagmula ang gitara? Asked By Wiki User
Uri ng tekstong nareysyon? Asked By Wiki User
Can you get Takis at 7 eleven? Asked By Wiki User