answersLogoWhite

0


Best Answer

No. Once a method is declared final in a class, no derivative of that class can override that method.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

Yes we can override instance method.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you override an instance method and make it final?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

When do you declare a method final in java?

You declare a method final in Java when you do not want any subclasses of your class to be able to override the method. I have also heard that this allows the Java compiler to make more intelligent decisions. For example, it supposedly allows Java to decide when to make a method inline. (Note that this is all unconfirmed)


How do you prevent method overriding in java?

Use the word "final" directly preceding your method declaration. The presence of final keyword directs java to ensure that, this particular method would not be overridden by any of its child classes.


How all objects will share single method copy?

A "static" method belongs to the class, not to any particular instance. So make it static method.


A final class can have instances?

Yes. You cannot inherit a final class but very well instantiate a final class


Static method can be overridden?

Depends. A non-static method that is declared final cannot be overridden. A non-static method in a final class cannot be overridden. A non-static method that is declared private cannot be overridden. A non-static method that is declared with package visibility cannot be overridden by classes in a different package. Other than that, yes.


Static variable and static methods in java?

== == Static method cannot be overwritten because it belongs to the class and not to the ObjectIf you're asking about overriding or overloading, then yes. Static methods can be overridden and overloaded just like any other methods.


Why did scientists use the Scientific method?

They used this method to make sure all data is 100% ture, and so the final results stay the same.


What does the final modifier mean on a method parameter?

We usually use the final modifier on parameters to methods when we want to make it clear that the supplied value cannot be modified inside the method. The compiler would complain as soon as you accidentally try to assign it a new value inside the method


Do you use virtual functions in Java?

Every method in java that isn't a class (static) method is automatically "virtual." If you want to disable virtual overrides, make the method "final" in the base class.


What is the purpose if declaring object with keyword const in c plus plus?

The const keyword transforms a variable into a constant. This means the constant cannot be altered via that constant's identifier. The const keyword can also be applied to a class instance method, such that the method will not alter a class instance's immutable members. Note that the const keyword is merely a programming aid that provides assurances a constant will not be altered inadvertently. However, it is still possible to alter the constant by using a non-constant pointer to the constant. However you have to make a conscious effort to override constant behaviour.


What do you do when your PS3 wont turn off?

It happens and the easiest method is to pull out the power cord and then plug it back in. Make sure you want the PS3 to turn off as it will override the PS3 protection from shutting down


What is overriding in java?

Providing a declaration which matches another declaration of the same name, thereby hiding the existing declaration.In terms of object-oriented programming, overriding is the ability of a subclass to "override" and replace the functionality of a method.Example:class A {f(){print "A"}}class B extends A {// Function f is overridden.// When B.f() is called, it will call this function instead of A.f()f() {print "B"}}