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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:50:57+00:00 2026-06-15T11:50:57+00:00

Default visibility in java means only other classes in the same java package can

  • 0

Default visibility in java means only other classes in the same java package can access it. I certainly see the use of it, and have used it in several occasions.

On the other hand, 90% of the default visibility I encounter is simply from a developer that forgot to add any visibility keyword.

So, on the one hand, there’s legitimate uses, on the other, it often masks bad code. What do you do in your development teams?

  • 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-15T11:50:58+00:00Added an answer on June 15, 2026 at 11:50 am

    I generally try to get everyone to start with the most limited scope and only start to expand outward if we see that it’s necessary in the design. Occasionally the decision to move from private to package-private is also driven by our need to write tests without having to go down the route of using a mocking framework (see Powermock).

    To add to this, we follow the same mentality on mutability. Everything starts out as final and only as we see the need to modify state do we remove it.

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

Sidebar

Related Questions

Default JVM uses maximum 1.5 GB RAM/JVM Java application. But my Server have 8
I have a usercontrol loaded inside a canvas; this usercontrol on default have visibility
This is my code in which I have set the div visibility by default
In C++, why is private the default visibility for members of classes, but public
I have some html which seems to default to : <ul style=top: 72px; visibility:
I have a text box in a page. Whose visibility is set false from
I have linked a library with my program. It works fine. The only problem
I have a panel in Itewmtemplate of list view it's only supposed to show
I have a RelativeLayout with several nested LinearLayouts. By default the LinearLayouts have visiblity
Is there a way to set the default visibility for attributes and methods in

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.