0
If we put print command in second function in the given programming then why does not it execute both methods?
6 ответов
+ 2
because the main method is used as a starting point of a statement in java. which is not in case of other method
it tutorial it created method sayhello and used it in main method to execute so the execution is only one time ie in main method. hope it helps you.
+ 1
? can you put a bit of code in it. Its hard to understand what you mean.
0
yes give a explanatory code for it to understand the question?
0
class MyClass {
static void sayHello() {
System.out.println("Hello World!");
}
public static void main(String[ ] args) {
System.out.print("sayHello");
}
}
why don't it print both methods
0
you are only executing one. you need to call sayHello ();
0
thank you