public static void print(String s) {
//write your code here
String data = print.("Java is easy to learn!");
String data = print.("Java opens many opportunities!");
print.write(data);
String data = print.read("Java opens many opportunities!");
String data = print.read("Java is easy to learn!");
print.write(data);
}
}
I have difficulties in getting this task done as i dont understand anything
Resolved
Comments (4)
- Popular
- New
- Old
You must be signed in to leave a comment
smile
20 April 2019, 01:13
The requirement says "The main method should not call System.out.println or System.out.print.", but it didn't say we can't use System.out.println on the print method, so you can try using string "s" to express this method, like
0
VIKAS SAHU
8 April 2019, 20:24useful
Don't make it complicated, it is very easy. Just complete the print(String s) method by writing its body. Just write code for printing the output (and you know it that's why you are here). just write it no. of times you want your function to print.
+2
Arqu07
8 April 2019, 12:43useful
No worries! I don't really understand your code that you posted here. On screen you should display this:
"Java is easy to learn!"
"Java is easy to learn!"
"Java is easy to learn!"
"Java is easy to learn!"
"Java opens many opportunities!"
"Java opens many opportunities!"
"Java opens many opportunities!"
"Java opens many opportunities!"
You just calling this print method in the main method by passing this two strings. And in the print method you need to make the passed string s printed 4 times.
+4
Sergo
22 August 2019, 13:49
Thank you, bro
0