Implement the print method

  • 3
  • Locked
Writing your own methods is the way to achieve unlimited freedom, but it is also a great responsibility. We implement methods carefully and thoughtfully. This task requires you to write a print method that will display a certain string. Not once, but four times. The string is a method argument, meaning that it will be supplied as an input.
You can't complete this task, because you're not signed in.
Comments (121)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Martin Rivas Anaya
Level 2 , Argentina
29 May, 22:52
jajja me re costo, pero era solo poner el println adentro de un ciclo for de 4 iteraciones
Anonymous #11311762
Level 4 , El Salvador, Guatemala
19 March, 04:49
Usen el ciclo for (int i = 0; i < 4; i++) en su metodo print
Anonymous #11307042
Level 2 , Medellín, Colombia
6 March, 11:46
despues de leer sientos de comentarios pude y la solucion es mas facil de lo que pense System.out.println(s); System.out.println(s); Output Java is easy to learn! Java is easy to learn! Java is easy to learn! Java is easy to learn! Java is object-oriented! Java is object-oriented! Java is object-oriented! Java is object-oriented! Java is platform-independent! Java is platform-independent! Java is platform-independent! Java is platform-independent!
Sol Ange
Level 2 , Spain
15 January, 17:55
Tuve que solicitar la solución del sistema, porque hace 4 horas y media que estoy varada en este ejercicio. Aún con el ejercicio resuelto,... no entiendo por qué es como es. Veré si en la siguiente lección explican algo.
Array Chinaski
Level 4 , Valencia, Spain
26 December 2022, 14:08
Una pista sería decir que lo de main no hay que modificarlo, y te pide que completes la función/método print para que se muestre 4 veces. Lo he intentado varias veces de las formas más difíciles y resulta que es la solución más fácil.
Sabine Meijran-Prins
Level 2 , Almere, Netherlands
30 August 2022, 08:58
Why is there a task like this.. With methods that are not explained yet..
Doomer man
Level 3 , United States of America
7 June 2022, 23:38
I got the answer but I don't know why the argument (String s) works the way it does, where in this code do we even declare string s and why does string s print everything from the main method, how and why does it store all 3 prints and could you pass on a different argument like String A or something and would it store all those print statements the same way? I guess what I am trying to say here is that why does the argument String s works the way it does where it prints all 3 statements instead of like 1 statement?
Sabine Meijran-Prins
Level 2 , Almere, Netherlands
30 August 2022, 09:02
I have exactly the same question..
Anonymous #10991784
Level 2 , Tamilnadu , India
4 May 2022, 06:32
why not print👇 Java is easy to learn! Java is object-oriented! Java is platform-independent! Java is easy to learn! Java is object-oriented! Java is platform-independent! Java is easy to learn! Java is object-oriented! Java is platform-independent! Java is easy to learn! Java is object-oriented! Java is platform-independent! why print👇 Java is easy to learn! Java is easy to learn! Java is easy to learn! Java is easy to learn! Java is object-oriented! Java is object-oriented! Java is object-oriented! Java is object-oriented! Java is platform-independent! Java is platform-independent! Java is platform-independent! Java is platform-independent!
agileMeadow
Level 2 , Korea, Republic of
5 July 2022, 06:04
Did you figure this out? I have the same curiosity
Jeff Kenney
Level 3 , United States
28 November 2021, 05:01
After reading all of these comments, it appears that the CodeGym Team could add some extra explanation here. The exercise seemed a little poorly timed as I was only able to figure out the solution from reading the comments here. However, the easiest fix for the confusion here would be adding an extra sentence in the instructions mentioning how the program calls the Main String through String S or something like that. That is just my opinion 🤷‍♂️.
vishal sharma Java Developer
14 October 2021, 19:02
System.out.println(s); four time but i dont know why is right
Dav
Level 2 , United States of America
23 October 2021, 13:35
Bc “System.out.println(s);” is in the method print not main. -using println puts it on a new line -the method main calls print the correct number of times