public static void method() {
|
Static is exactly the same as a non-static method, except there's no need to instance the class to access it.
For example, the 'players' array in the playerHandler class should be static, and not instanced through the Server class.
public class StaticClass {
public static class ActionShit {
public static void action() {
System.out.println("Action");
}
}
}
public void doSomething() {
StaticClass.ActionShit.action();
}
Btw, if your gonna put local variables in the static method, those variables have to be static aswell, along with the methods.
And if it's not static, then you would just call an instance.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |