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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:09:41+00:00 2026-06-11T21:09:41+00:00

I am currently learning Java on my own, and this question has been puzzling

  • 0

I am currently learning Java on my own, and this question has been puzzling me for a while, even though I’m sure the answer is a simple one. I was wondering whether there are hidden methods obtained through extending certain classes, such that you can call the method in the subclass without referencing super.method(… ? For example, take a look at this ButtonPanel class:

class ButtonPanels extends JPanel {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    public ButtonPanels(){
        JButton yellow = new JButton("Yellow");
        JButton blue = new JButton("Blue");
        JButton red = new JButton("Red");

        add(yellow);
        add(blue);
        add(red);
    }
}

The “add” methods here… where do they come from? It seems that writing super.add works perfectly fine, which confuses me. Don’t you need to write super in front of all methods you call from a superclass?

  • 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-06-11T21:09:42+00:00Added an answer on June 11, 2026 at 9:09 pm

    These are not “hidden” methods. The super. is optional when calling a method from the superclass (as long as you haven’t overridden it in your own class, then you need super. to distinguish it from your own implementation).

    The documentation for JPanel lists all these methods under the “Method Summary” header, specifically in the “Methods inherited from class java.awt.Container” section (there are multiple overloads of add which is why it is mentioned more than once there).

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

Sidebar

Related Questions

im currently learning stacks in java and have a quick question. what will the
I am currently learning about basic networking in java. I have been playing around
I'm trying to compile some java (learning java currently), and to do so I
I'm learning regex, and I can't understand the grouping in Java. Currently my regex
I am currently learning Javascript, and I'd like to create my own Lorem Ipsum
I'm currently learning Java, using a combination of the Head First Java book and
I’m currently learning the Java Collections API and feel I have a good understanding
At school we are currently learning sorting algorithms in Java and I got for
I am currently learning Hibernate and the Java Persistence API. I have an @Entity
I'm currently learning the C programming language (coming from Java) and I'm a bit

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.