0
Java beginner question please help
class MyClass { static void sayHello() { System.out.println("Hello World!"); } public static void main(String[ ] args) { sayHello(); } } // Outputs "Hello World!" 1)why do we need static void in the sayHello() method?what does it mean when we include them? 2)if we add in public to sayHello() method,does it make a different to this code?does it mean i can use this method in other classes if i add the word "public"
3 ответов