I'm sorry, I'm not even able to understand what's the request of the task: "In the print method, display the passed string 4 times. Each time, on a new line."
What's a "passed string"?
Not able to understand
Resolved
Comments (6)
- Popular
- New
- Old
You must be signed in to leave a comment
John Raets
16 September 2020, 19:00
How can you display it 4 times without using a loop?
0
Шарох
18 July 2020, 15:35
you should change value of (string s) to equal.then print it .
0
punkuotukas
4 June 2020, 05:49
It passed now, but I got even more confused. There is no reference to variable s in the main method. How does the print method know that with s I'm referring to the lines indicated in the main method?
I mean - the code looks very incomplete in this task.
0
Tim Zoellick
3 June 2020, 18:59
In the assignment ... public static void print(String s) creates a method that requires a String.
then ... print("Java is easy to learn!"); calls the method print and passes the string "Java is easy to learn!"
+1
Jonas
3 June 2020, 13:15solution
Tavo print metodas turi ispausdint duodama stringa keturis kartus, tai jei tau duota "labaDiena", turi ispausdinti:
labaDiena
labaDiena
labaDiena
labaDiena
kad tai padaryti, tu turi:
public static void print(String s) {
System.out.println(s);
System.out.println(s);
System.out.println(s);
System.out.println(s);
}
+4
AnnemiekFF
3 June 2020, 10:35
A passed String is the string that is passed into the method. Your method has a parameter with a String type. That is your passed String. And they want you to show that string on 4 lines.
0