package com.codegym.task.task02.task0218;
/*
Repetition is the mother of all learning
*/
public class Solution {
public static void print3(String s) {
//write your code here
int s;
for(int x=0;x<3;x++){
printf(print3);
}
}
public static void main(String[] args) {
print3("I love you!");
}
}
how to implement the method?
Under discussion
Comments (9)
- Popular
- New
- Old
You must be signed in to leave a comment
Karumuri Sneha
20 March 2019, 16:22
u can also use for loop for this program as shown
int i=0;
for(i=0;i<3;i++){
System.out.println(s);
}
or
just write 3 times System.out.println(s); to print 3 times
0
Tashi Sandup
1 November 2018, 15:38
as you can see that the method 'print3' is not returning any value i.e, void so you cannot use return type in this program.
hope you got what i said.
0
Tashi Sandup
1 November 2018, 15:41
sorry you didn't returned any value and its correct. just change the syntax from 'printf' to 'System.out.println' and put the string variable inside this syntax.
you have to repeat the arguments not the method.
0
gery
12 September 2018, 19:19
/* The comment was deleted */
0
Roman
13 September 2018, 07:32
Posting the solution in the comments is prohibited.
0
DuesVultKek
24 August 2018, 14:43
You just went ahead. For loop?
Come on buddy but let me help ya.
The hint is that never use print3 inside System.out.println.
0
Roman
22 August 2018, 08:01
Try to read this lesson again and then return to the task.
+4
Rishi Raj
2 December 2018, 10:11
thanks ,it helped a lot
0
Abdur Rehman
26 March 2019, 17:12
thx roman it really helped i was using return instead of what was supposed to be used
0