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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:50:12+00:00 2026-05-22T16:50:12+00:00

I know the difference between static type and other types but I am not

  • 0

I know the difference between static type and other types but I am not sure which is to used where. Now I am using static types in all places to avoid object instantiation. Is it a good idea to use it that way ? Is there any particular disadvantage in using static type in all places ??

EDIT

What do you call this as static String staff ?

  • 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-05-22T16:50:13+00:00Added an answer on May 22, 2026 at 4:50 pm

    This is an excellent question. Usually you should not use static methods/variables unless you know for sure that it’s a correct application for it. In object oriented programming (OOP), objects encapsulate data and behavior. Typically, *instance methods are used to manipulate the object’s data.

    Static methods/variables should only be used for functionality that is not associated with any particular object. A good example of a valid application for static is Math.random().

    Some notes about instance and static methods/variables:

    • Instance variables have access to static and instance variables/methods, but static methods can only access other static variables/methods.
    • A static variable will always be the same across all instances of a class.

    A good book to read that covers this topic is Clean Code by Robert Martin. Highly recommended.

    *instance methods are the opposite of static methods. They are associated with a class instance, instead of the class itself.


    Addressing your edit, assuming that that’s a variable, you’d access it like this:

    MyClass.staff = "bob, george, and linda";
    System.out.println(MyClass.staff);
    

    Edit: here’s a post I made on another forum a while back, with some good answers. It’s a PHP forum, but the concepts still apply.

    http://forums.devnetwork.net/viewtopic.php?f=1&t=127667

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

Sidebar

Related Questions

I would like to know difference between static variables and global variables in terms
I am eager to know the difference between a const variable and a static
I would like to know what is the difference between initializing a static member
Now, I know a difference between parameters in a URL and a POST parameter:
I want to know the difference between making the cells in my UITableView Static
Is there any difference between a Singleton class and a class with all static
I would like to know what is the difference between static memory allocation and
I know the difference between static and dynamic linking, and this isn't another question
I would like to know what is the difference between static variables in a
I know the difference between ASP.NET webforms and ASP.NET MVC and I've seen quite

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.