I'm doing a beginner's exercise, and the goal is to create the below output:
Hello Billy, it's good to meet you!
Hello Jake, it's good to meet you!
Hello Michael, it's good to meet you!
Below is my code:
package apollo.exercises.ch03_methods;
public class Ex2_SayMyName {
public static void main(String[] args) {
String name1 = "Billy";
String name2 = "Jake";
String name3 = "Michael";
}
public void SayMyName(String name){
System.out.println("Hello " + name + ", it's good to meet you!");
}
SayMyName(name1);
SayMyName(name2);
SayMyName(name3);
}
I get errors at SayMyName(name1);
and the }
above that line.
For }
, it says I need to insert another }
to complete the class body, but isn't it already complete?
For SayMyName(name1)
, I get "Syntax error, insert "... VariableDeclaratorId" to complete FormalParameterList"
What am I doing wrong? :(