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

  • Home
  • SEARCH
  • 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 920631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:44:51+00:00 2026-05-15T18:44:51+00:00

I would like to know the reason why this is first allowed in Java

  • 0

I would like to know the reason why this is first allowed in Java (or oops in general)
I remember that the static methods are common for both parent and child class

public class Redefine extends Parent{
    public static void test () {

    }
}


class Parent{
    public static void test () {

    }
}

Q1 : Since Overriding is not supported for static methods , how can both classe contain same methods ?

Q2 : If change the method in static to throw an exception not defined its not compiling.
why is the case. Its obviously not overriding so i should be allowed to throw new exceptions right ?

public class Redefine extends Parent{
    public static void test () throws Exception{

    }
}
  • 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-15T18:44:52+00:00Added an answer on May 15, 2026 at 6:44 pm

    A1:: static method are per-class. They have nothing to do with inheritance hierarchies in terms of polymorphism. So calling Parent.test() will call the parent method, while calling Redefine.test() will call the child.

    A2: JLS 8.4.8 writes:

    If a class declares a static method m, then the declaration m is said to hide any method m’, where the signature of m is a subsignature (§8.4.2) of the signature of m’, in the superclasses and superinterfaces of the class that would otherwise be accessible to code in the class.

    A method declaration must not have a throws clause that conflicts (§8.4.6) with that of any method that it overrides or hides; otherwise, a compile-time error occurs.

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

Sidebar

Ask A Question

Stats

  • Questions 501k
  • Answers 501k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer What you're looking for is probably a Patricia Tree or… May 16, 2026 at 2:15 pm
  • Editorial Team
    Editorial Team added an answer xVal is good! I'm using it with 2 asp.net mvc… May 16, 2026 at 2:15 pm
  • Editorial Team
    Editorial Team added an answer It seems that you are thinking of creating a RemoteFileSystemProvider… May 16, 2026 at 2:15 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

This may seem like a dumb question, but still I don't know the answer.
I would like to know how can I ask X11 which windows has the
I would like to know if it is possible to abstract the copy method
I would really appreciate your help in this. I have been trying to get
Unfortunately this is going to be a pretty open-ended question, but I am at
This might come as a strange question to many of you, and I don't
Am I right in understanding the .NET XmlIgnoreAttribute , which says: Instructs the Serialize
I believe the expression T() creates an rvalue (by the Standard). However, the following
We have a project where a vendor produces some custom code for us and
I'm maintaining an in-house ORM written in C#, and it currently does not have

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.