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 (104)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Víctor Alfonso Martínez Gómez
Level 3 , Manizales, Colombia
30 July, 17:58
El enunciado esta muy confuso
MathBechy
Level 2
2 July, 05:18
I don´t understand that 😔
4 July, 06:14
print is the name of the method. the next in green colour inside the brackets are the value that is passed to the method. Downwards, the "public static void print" is the method itself. Inside the brackets it's declared the type of variable that it will receive from the main class, in this case a String, and also the name that this string will have inside the method, in this case s. Given this, I think is clear what you need to print a String 4 times.
mahdi mahdi
Level 2 , Jeddah, Saudi Arabia
15 June, 14:19
i dont understand what want me do
mahdi mahdi
Level 2 , Jeddah, Saudi Arabia
15 June, 14:25
in frist say print then say shod not us print and printlin
James Hensley
Level 2 , Chicago, United States
29 May, 02:10
hint; guess, and then see if you're right. another hint, you must call the lines from the first module within the method.
NaTasia Madison
Level 7 , Atlanta, United States
15 May, 02:19
This was a little challenging at first but I figured it out. Are there other solutions other than the for loop?
John Hanagan
Level 2 , Newark, United States
29 April, 05:51
Bs, i got premium, it even shows the expiration date and yet I cant use hint...
Pahunchik
Level 8 , Moscow, Russian Federation
2 March, 19:42
I did it, but i did not understand how((( I dont understand what means "(String[] args)" and i know nothing about print comand. Why this task is here already?It's depressing when a task is given without a prior theory
John Squirrels Website Admin
4 March, 10:13
The theory will be explained later on to you. It is most def a task from the future.
sampex03
Level 4 , Berlin, Germany
5 February, 20:35
I am baffled that I still end up with a wrong feedback even when I do what I learned to implement the solution. Help me, someone...
Forrest
Level 2 , Fort Worth, United States
4 December 2020, 21:16
I'm unable to get the print method to display 4 times. I'm not sure what I need to fix. I typed in System.out.println("print); but it only displays 3 times....
chan kenneth
Level 7 , Hong Kong, Hong Kong
21 January, 07:37
you need a for loop to display the 3 sentences 4 times.
Steven
Level 3 , United States
24 November 2020, 17:01
Ok, so I just gave up and downloaded the correct solution, looking at what the correct solution is I am still confused. Why does is it when I type in "system.out.println(s);" does it print out what it is supposed to? how does it know that s is the text that is being printed? how does it know to print it out 4 times?
Alex
Level 41 , Solar System
25 November 2020, 12:33
The print() method takes a String as an argument and as that argument you pass it a certain string in the main() method when you call the print() method. This shows the print() method that it needs to do something with the string that you "feed" to it. In our case, the print() method needs to print out the string four times. So, when you call the print() method three times with three different strings, the print() method will print out each one four times.
Jake Sjoberg
Level 3 , United States
25 December 2020, 00:06
I was able to complete this through trial and error, but I essentially ended up in the same situation. I think what we are asking for is a clearer example of, how does s instantly link those lines of text. I think I grasp that the print method is using Strings as an argument, but how is it connecting the two. Through a beginner's eyes, it looks as if something is missing. Like there should be something else there to tell us that s is correlating those strings. If it's not needed, what are we looking for/missing?
Alex
Level 41 , Solar System
27 December 2020, 13:04
String s is the print() method's argument, which in Java syntax speak means that this method takes in a String variable and needs to do something with it. In the main method, we then provide/feed different strings to our print() method for processing.