+ 1
Wht does this work?
How come this: class MyClass { static void sayHello() { System.out.println("Hello World!"); } public static void main(String[ ] args) { sayHello(); } } // Outputs "Hello World!" Works even though I didn't include the class name?
1 Answer
+ 2
It is within the same class so doesn't need to called via the class name. It's optional in this case.