0
The question says create a method and use the method to print "hello world" in java. I need help please guys
Java methods creation
4 Réponses
+ 3
Moubaraq Uthman
Method should have return type. So here we can use return type void which not return anything. But you can call method to display results.
+ 3
Moubaraq Uthman
This is not right.
Create a method and print Hello World in this method and call the method in main method. So it should be like
static void print() {
System.out.println("Hello World");
}
public static void main (String [] args) {
print ();
}
0
Is it correct if i write something like this
Public lecture (){
}
Public static void main (string [ ] args){
System.out.print("hello world")
}
0
What about something like this
Public lecture (){
System.out.println("hello world")
}