Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Fern Sanchez   on Nov 21 In Java Category.

  
Question Answered By: Sherrie Thomas   on Nov 21

static  variable or method  is one
that exists without needing to
create an instance of the class.
There are only a few cases where
it is justified to use them;
overusing them destroys the meaning
of objects. Static variables are
used when there is a single instance
of the variable  to be used for all
instances of the class. Static
methods are used when there is
some action to perform that relates
to the class but does not act upon
an instance of it. In fact, static
methods cannot access an instance
of the class and can only make
use of static variables or other
static methods. That's a pretty
brief summary. Does it help?

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on static Or get search suggestion and latest updates.


Tagged: