What is @Override in java?

I am confused while understanding this Annotation. i don’t know what is the use of this Annotation. Please help me in Understanding the concept of @Override annotation.

What i have Tried

  1. i already search on google about this annotation but nothing found Helpful.
  2. i contacted many developer about this annotation but Still not found something.

What i know about this annotation

According to me, i know that it is used to call a method which is already created in another class which needs extend or import. And it have also a Super() method to pass the method’s parameters.

Notice

I know this type of Questions need to be ask on StackOverFlow . But my Account is on hold because of I ask a Question which needs more information.

Hope anyone help me in understanding this Annotation.

1 Like

You already have your answer in your post.

2 Likes

that’s it Sur @hammerhai

1 Like

@ Override @ Override annotation informs the compiler that the element is meant to override an element declared in a superclass. … If a method marked with @ Override fails to correctly override a method in one of its superclasses, the compiler generates an error.

Predefined Annotation Types (The Java™ Tutorials > Learning the Java Language > Annotations).

2 Likes

Read this

1 Like

it’s difficult to understand and @hammerhai already mentioned that i have already answer in my post.

2 Likes

You need to stop sending people PMs who you might know or think have experience.

3 Likes

sorry, okay sur @hammerhai

1 Like

We use @Override in Java because it instruct the compiler that we are overriding the method. If we don’t use the @Override, then the sub class method may behave as a new method in sub class(also called as child class).

4 Likes

thanks @golumaths100 and @Mohamed_Tamer

2 Likes

You’re welcome. Hope it is clear to you now. :slight_smile:

2 Likes