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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:16:31+00:00 2026-06-03T16:16:31+00:00

I was wondering what it means to say a field is hidden between 2

  • 0

I was wondering what it means to say a field is hidden between 2 java classes and
what it means when running code in terms of resulting output?

I have an abstract class with a protected static boolean field = false and a sub class
which has a boolean field with the same name but is not static and set to true.

If I had this code:

Superclass d = new subclass();

what would be the value of the boolean field in the superclass and the boolean field
in the subclass? Does subclass field stay as false after the assignment above?

  • 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-03T16:16:33+00:00Added an answer on June 3, 2026 at 4:16 pm

    static members are never overridden (and certainly not by non-static members). And since you should access them like this: ClassName.member there is also no need to worry about hiding them.

    In your case, you would access the Superclass field like this: Superclass.field. And the field of a Subclass instance like this: subclass.field. If you have, however a Subclass instance in a Superclass variable like above, this code: d.field will access the static field defined in Superclass, which will be false in your case.

    But this does not change the value of the Subclass instance, it just accesses the “wrong” member! You can verify this by putting the instance in d back into a Subclass variable and reading field again.

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

Sidebar

Related Questions

I have a list of objects I need to sort on a field, say
Say I have the following code: #include <iostream> #include <functional> template <int func(int)> struct
I have a question about relationships between two tables. Let's say we have a
I was wondering about something, cucumber returns an exit code 0 (which means ok
Say I have a textbox in HTML using the following code: <input type=text name=text
Let's say we have a tag called test, i.e. [code] . What I'd like
I'm just wondering what it means to attach a number as a parameter to
I'm wondering if there is a standard or normal means of interpreting time interval
Wondering if someone could please explain the difference between these two queries and advise
Wondering if someone could help me. I have next to no knowledge with Ajax,

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.