answersLogoWhite

0

The objective of overriding in Java is to provide features for a class to define its own behavior even for cases where the super class that it extends has already defined one.

There might be cases where we want a specific behavior in our class but if the super class already has a method that does the same thing we wont be able to implement our behavior. Hence this overriding concept is available which lets us write our own implementation which would mask the code in the super class and let us run our logic.

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

Is overriding a dynamic polymorphism in c plus plus or not?

In C++, overriding and function, method, or operator is a different thing than (dynamic) polymorphism, so overriding a polymorphic method is almost entirely possible.


Example of overriding in java?

For example: class Speak { void SayHello(){}; } class Boy extends Speak { void SayHello(){System.out.println("I'm a boy");} } So overriding is usual to rewrite the motheds in subclasses .In subclsses ,you can override the methods acceded from his parent class.


What is function overriding in oop?

Function overriding in object-oriented programming (OOP) occurs when a subclass provides a specific implementation of a method that is already defined in its superclass. This allows the subclass to customize or extend the behavior of the inherited method. The overridden method in the subclass must have the same name, return type, and parameters as the method in the superclass. Function overriding is a key mechanism for achieving polymorphism, enabling dynamic method resolution at runtime.


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 the scope of method overloading and overriding?

Overloading happens when you have multiple methods in the current class that have the same name but different signature. The scope of method overloading is "Within the current class" Overriding happens when your current class extends another class (the parent class) and provides implementation for a method that is already available in the parent class. The scope of method overriding too is "Within the current class"

Related Questions

Make a sentence with the word overriding?

Your safety is our overriding consideration.


Is overriding a dynamic polymorphism in c plus plus or not?

In C++, overriding and function, method, or operator is a different thing than (dynamic) polymorphism, so overriding a polymorphic method is almost entirely possible.


What is the opposite of overriding?

The opposite of the gerund overriding would be approving or endorsing.(In the US Congress, the failure to override a veto is confirming it.)The adjective overriding (meaning of primary importance, overarching) has the opposites secondary, insignificant, negligible, or unimportant.


How can you end a veto?

by overriding the veto


What was first boycott was overriding on?

blacks


Is it possible to do method overloading and overriding at a time?

no we cannot do both at the same time because overloading requires different arguments and overriding dosenot


When the concept of method overriding is necessary?

concept of overriding is very important as due to overriding the derived class can use the function of the base class! when the function has same name and prototype in both the classes(base and derived) then the derived class can use the funtion of base class!


What power belongs on this list?

Overriding a presidential veto


Is it possible to implement method overriding in each and every type of inheritance?

Yes. Method Overriding is not possible without inheritance and it can be done in all possible types of inheritance.


How is hiding method different from overriding method in c sharp?

Hiding means a class cannot see the definition. Overriding implies that a class must see that to "override"


What is a operator overriding in java?

Java does not support object overriding. It does support operator overloading by means of the "+" symbol which is used for both numeric addition as well as string concatenation.


Is overriding a preposition?

No, overriding is not a preposition. It is a term often used in computer programming to refer to the action of replacing or modifying a method or function in a superclass with a new implementation in a subclass.