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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:04:08+00:00 2026-06-10T19:04:08+00:00

Section 10.2 of Java conventions recommends using class names instead of objects to use

  • 0

Section 10.2 of Java conventions recommends using class names instead of objects to use static variables or methods, i.e. MyClass.variable1 or MyClass.methodName1() instead of

MyClass Obj1 = new MyClass();    
Obj1.variable1;
Obj1.methodName1();

There is no explanation of the rationale behind this, although I suspect this has something to do with memory use. It would be great if someone could explain this.

  • 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-10T19:04:09+00:00Added an answer on June 10, 2026 at 7:04 pm

    I guess you mean “for static methods and variables”.

    There is no difference regarding memory, except of course if you create the instance just for calling the method. Conventions aren’t for memory efficiency but for coder efficiency, which is directly related with the readability of the code.

    The rationale is that by reading

    MyClass.methodName1()
    

    you know it’s a static method and that it can’t use or change your Obj1 instance.

    And if you write

    obj1.variable1; // note the "o" instead of "O", please do follow conventions
    

    then the reader has to read your source code to know if variable1 is static or not.

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

Sidebar

Related Questions

I am reading Effective Java. In a section that talks about using function objects
I work in java web application . In some section i use very huge
Using Java, I have a class which retrieves a webpage as a byte array.
I am currently writing a Java compiler and have implemented section 15.12.2.7. of the
Reading Java Concurrency In Practice, there's this part in section 3.5: public Holder holder;
The Java language spec defines semantics of final fields in section 17.5 : The
I was working on a Java lesson and the section was on Enumerations. I
i try to compile a java program but in the import section of the
I noticed the following in the Java Language spec in the section on enumerations
Problem: I am using Java Tutorials™ sourcecode for this. This is the source code.

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.