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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:26:40+00:00 2026-06-01T14:26:40+00:00

Is there a runtime performance differance between public and private variables/methods? I know that

  • 0

Is there a runtime performance differance between public and private variables/methods?

I know that it is considered good practice to keep things private if possible, but is there any optimisation related reason.

  • 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-01T14:26:42+00:00Added an answer on June 1, 2026 at 2:26 pm

    Like most of these questions I would say; write clear, simple code and it will perform well also.

    If some one tells you something is a good idea for performance reasons, make sure this is backed up with real numbers, is still the case for the version of Java you are using (much of this advise is out of date), and it is appropriate for your application.

    Often “performance reasons”, is an excuse to write obscure code, when actually it may be no faster or can even be much slower (as it confuses the JVM optimiser, just as it will confuse you)

    Some people are so sceptical of performance optimisation that you have the quote “premature optimisation is the root of all evil” This is an exaggeration, but it is a good warning, not to worry about performance concerns unless you really know you need to improve performance, and your changes really make a difference.

    To this specific question, you can’t call a private method from another class. So basically, you can’t from another outer class, and from another class in the same outer class, and accessor is created which would normally be inlined if called enough.

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

Sidebar

Related Questions

Are there significant performance differences (at runtime and/or compile time) between constructing and assigning
Is there a good way to debug exited with code 5 runtime error on
Is there a way to create Java classes @ at runtime (classes methods n
Is there any good tutorial for creating WPF controls entirely at runtime? Thanks
Say there is a dict variable that grows very large during runtime - up
Is there a runtime performance penalty when using interfaces (abstract base classes) in C++?
I am wondering if there is any difference in runtime between a generic container
I know there are several posts already concerning the difference between casts and the
I am wondering if there is any performance differences between String s = someObject.toString();
Is there a way to change the application language during runtime? So, after the

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.