
-----------------------------------
abogaida
Thu Apr 09, 2009 6:55 am

Static and non-Static methods
-----------------------------------
What is the different between static and non-static methods?

-----------------------------------
[Gandalf]
Thu Apr 09, 2009 9:19 am

RE:Static and non-Static methods
-----------------------------------
Non static members belong to instances of a class, while static members belong to the class itself.  For more information, read wtd's [url=http://compsci.ca/v3/viewtopic.php?t=9576]Introduction to Java.

-----------------------------------
matt271
Thu Apr 09, 2009 3:01 pm

Re: Static and non-Static methods
-----------------------------------
say u have:

public class SomeClass {
 public static void someStaticMethod() {
  System.out.println("this is a static method");
 }

 public void someMethod() {
  System.out.println("this is not a static method");
 }
}

then you would call them like this:

SomeClass.someStaticMethod();

SomeClass blah = new SomeClass();
blah.someMethod();


:D

-----------------------------------
abogaida
Thu Apr 09, 2009 4:02 pm

RE:Static and non-Static methods
-----------------------------------
thanks for the information :)
