See if this helps...
a static method is called by referring to the CLASS name, and then the method. One example is the Math class. you can NEVER have a Math object, the compiler won't let you say
but the Math class has lots of methods i want to use. since all the methods are static, i can call them like so:
Similary, your main() method MUST be static.
a non-static method must be called from a specific instance of a class. for example, the
String class has a method with the signiatur
this tells you what character is at a specific position within a string. So, it's obvious i NEED a string to use this. it would make no sense to say
What string are we looking in? i need something like
notice this time, i called the method by using an actual object (more precisely an object reference), not the CLASS name.
does that help?
[ March 08, 2004: Message edited by: fred rosenberger ]