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 731117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:59:23+00:00 2026-05-14T06:59:23+00:00

This question occured to me while programming a Android application, but it seems to

  • 0

This question occured to me while programming a Android application,
but it seems to be a general programming question more.

The situation is, I am extending (subclass-ing) an class from a library, and overriding a method. how do I know if I should invoke the method of super-class? and when? (in the beginning of the overridden method or in the end?)

For example, I am overriding the method “public boolean onCreateOptionsMenu(Menu menu)” from class “Activity” in Android platform. And I saw someone write “return super.onCreateOptionsMenu(menu)” in the end of the method, in an example. But how do I know it should be done this way? and it is correct or not? what’s the difference if I begin my method with “super.onCreateOptionsMenu(menu)”?

BR,
Henry

  • 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-14T06:59:23+00:00Added an answer on May 14, 2026 at 6:59 am

    I don’t think you can answer this question in the abstract: it depends on the behavior of the superclass method you’re overriding.

    Depending on circumstances, it may be appropriate to:

    • call super first
    • call super last
    • handle some cases yourself (customizations), call super for the rest
    • never call super

    Hopefully the documentation for the particular class you’re overriding will tell you if/when it’s necessary to call super.

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

Sidebar

Related Questions

This question is about good programming practices and avoiding potential holes. I read Joshua
I was trying out some c++ code while working with classes and this question
I'm very sorry about this being a very cliché question, but I really need
While contemplating this question about a SQL INSERT statement, it occurred to me that
I realize that this question has been asked and has been answered here but
You think to yourself: what this question has to do with programming? Let me
I was pondering this question last night while debugging some things in IE7, when
Sorry if this is the most seen question on the web, but this is
I already asked this question before, but without any good response, my problem is
Disclaimer While this question looked like a potential duplicate , it was resolved by

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.