Please Am stuck again........... Java says when void is used in a method it doesnt return any value.......
Yet it is possible to call a method that is void......... why all these??..........its so confusing that I dont know how to explain my question....... /* now this code returns the value of sum since it isnt void */ class MyClass { static int sum(int val1, int val2) { return val1 + val2; } public static void main(String[ ] args) { int x = sum(2, 5); System.out.println(x); } } /* and this code also does sayHello() even though its void.........Now the question is; "I thought void doesnt return any value, how come the public class still does the instructions in sayHello()?" */ class MyClass { static void sayHello() { System.out.println("Hello World!"); } public static void main(String[ ] args) { sayHello(); }