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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:19:04+00:00 2026-06-16T05:19:04+00:00

Considering some security issues, I don’t want the subclass inherit the static method from

  • 0

Considering some security issues, I don’t want the subclass inherit the static method from its super class,not even call this method, how can I do this? Please help!

  • 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-16T05:19:05+00:00Added an answer on June 16, 2026 at 5:19 am

    Static methods are not inherited in the same sense as instance methods are. If you declare a static method as public (or package private) it is accessible whether or not there is a local redeclaration in a child class. The local redeclaration merely means that the child class has to qualify the name of the method; e.g.

    public class Parent {
        public static void foo() { ... }
    }
    
    public class Child {
        public static void foo() { ... }
        public static void main(String[] args) {
            foo();  // calls local override
            Parent.foo(); // calls original version.
    }
    

    If you don’t want the Child class to be able to call the Parent.foo method, then you need to declare it as private (or maybe package private if Child and Parent are in different packages.)

    But even then, if the Child class has permission to use reflection, then it can easily use that to call a private method in the Parent class. So unless you are sandboxing your code Java access modifiers are not a security mechanism.

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

Sidebar

Related Questions

I was considering reassigning some functions from a standard library module in my testing
we're considering exposing some C# types to C++ clients via COM. What problems can
I'm considering storing some date values as ints. i.e 201003150900 Excepting the fact that
I have small game engine written in c++. I'm considering using some features of
I'm considering picking up some very rudimentary understanding of assembly. My current goal is
My company (EU-based) is considering to release some parts of our code under a
I'm considering using memcached (at some point) in my application i'm currently developing. Eventually,
I'm considering using Berkeley DB to cache some data on an application cluster. What's
I am considering starting an OSS project and would like some advice. I would
I'm considering a design for a private messaging system and I need some input

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.