0

What is wrong in the following program?

public class Test { public static void main (String [] args) { nPrintln(5, "Welcome to Java!); } public static void nPrintln (String message, int n) { int n = 1; for ( int i = 0; i<n; i++) System.out.println(message); } }

28th Oct 2019, 9:54 PM
Jibrilla Abdul-Razak
Jibrilla Abdul-Razak - avatar
4 Respuestas
+ 2
Even if this is homework help or something, this is a good excercise for me too, so here goes, hope it helps 😊 1) method nPrintln() parameters defined(String, int) but you call it backwards with (int, String) 2) int n is passed a value of 5, so there's an error/conflict, you can delete "n = 1" 3) missing quote mark" around "Welcome to Java!" https://code.sololearn.com/c7UjXS0WrsHe/?ref=app
28th Oct 2019, 10:05 PM
will
will - avatar
+ 2
Please take note of this little hint: If you have some questions about your code please use the plus button (+) right above to add your code like will have to do this. It's more easyer to understand and analyse . Regards kiuziu
28th Oct 2019, 11:20 PM
Kiuziu 💘 Berlin
Kiuziu 💘 Berlin - avatar
+ 1
Thanks Will
28th Oct 2019, 10:28 PM
Jibrilla Abdul-Razak
Jibrilla Abdul-Razak - avatar
0
Thanks
29th Oct 2019, 10:27 AM
Jibrilla Abdul-Razak
Jibrilla Abdul-Razak - avatar