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: Jamie Roberts   on Nov 21

Basicly anything the Object always has to know and can never change (no
matter how many of those objects you call) can be static.

A good example of a static  method would be something like the command
list for a FTP server session. No matter how many sessions with clients
that server has, every single command that it can accept is exactly the
same and can never change.

The main method  is the most common example of a static method, basicly
it can be run before the rest of the Object is constructed (they normaly
construct the constructor for a runnable class).

You can have plenty of static methods, for example the Maths class makes
good use of many static methods, such as Maths.random(). No new input or
variables can be inserted into Maths.random() and it doesn't need you to
construct a maths object (ie you don't need Maths maths = new Maths();
maths.random();)

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: