+ 2
Could Someone help me do this?
I want to make a code but I'm a beginner to java and don't know what is the problem Code: https://code.sololearn.com/cc1iYZSZx6x1/#java
2 Antworten
+ 3
The Strings: name1, name2, and name3 are declared within a function. So they are out of scope for where you are trying to print them.
The code below might not be set up as you want it, but it will work.
If you need any help let me know
class MyClass {
static void sayHello(String name) {
System.out.println("Hello " + name);
}
static void names(String name) {
}
public static void main(String[ ] args) {
String name1 = ("Darius");
String name2 = ("Daria");
String name3 = ("Karla");
sayHello(name1);
sayHello(name2);
sayHello(name3);
}
}
0
Thanks!! It works!