Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3756354
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:50:21+00:00 2026-05-19T09:50:21+00:00

I am completely new to Android Studio and I want to know the purpose

  • 0

I am completely new to Android Studio and I want to know the purpose of the @Override statement in Android Studio.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T09:50:21+00:00Added an answer on May 19, 2026 at 9:50 am

    @Override is a Java annotation. It tells the compiler that the following method overrides a method of its superclass. For instance, say you implement a Person class.

    public class Person {
       public final String firstName;
       public final String lastName;
    
       //some methods
    
       @Override public boolean equals(Object other) {
          ...
       }
    }
    

    The person class has an equals() method. The equals method is already defined in Person’s superclass Object. Therefore the above implementation of equals() is a redefinition of equals() for Persons. That is to say, Person overrides equals().

    It is legal to override methods without explicitly annotating it. So what is the @Override annotation good for? What if you accidentally tried to override equals() that way:

    public boolean equals(Person other) {
       ...
    }
    

    The above case has a bug. You meant to override equals() but you didn’t. Why? because the real equals() gets an Object as a parameter and your equals() gets a Person as a parameter. The compiler is not going to tell you about the bug because the compiler doesn’t know you wanted to override. As far as the compiler can tell, you actually meant to overload equals(). But if you tried to override equals using the @Override annotation:

    @Override public boolean equals(Person other) {
       ...
    }
    

    Now the compiler knows that you have an error. You wanted to override but you didn’t. So the reason to use the @Override annotation is to explicitly declare method overriding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm completely new to Java/Android and am stuck with listviews. What I want is
I am new to Android. I want to know what the Looper class does
I am completely new to android, and pretty much a Java newb. I have
I am completely new to Jena/TDB. All I want to do is to load
I'm relatively new to Java, eclipse and android so this could be a completely
I'm completely new to Android development, but I just got a HTC Hero and
I am new to Android and I have bound my application completely but I
im trying to port an iphone app to android. i am completely new to
I am completely new with Android/Eclipse. I can't figure out how to add an
I am completely new to Android so forgive me if this is trivial. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.