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: Dang Tran   on Nov 21

Static variables or methods are used to deal with the calss variables
and not with instance variables.
To be more clear the main method  in Java is itself a static  method
in a class and the main method is declared as static because it has
to be called without creatinhg an instance of the class.
Similarly if you want any variable  or method belonging to that class to be
called
by the main method or any static method for that matter then you will have to
declare them as static.
At the same time a method declared as static can create instances of the class
and use them.

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: