Hello can anyone say what is the error in this program
public class Solution {
public static void main(String[] args) {
System.out.println("Hello");
System.out.println("Hey");
System.out.println("you");
System.out.println("whatsup");
Solution.print();
Solution.print();
}
public static void print(String s) {
System.out.print("Hello");
}
}
Kindly let me know what is the error in this program?
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Sanjith PK
22 April 2019, 01:59
Everything is correct except the fact that you haven't passed any arguments to Solution.print(). Pass a string argument inside it and everything should work just fine.
Example: Solution.print("Some String Arguement") ;
0
somecro
21 April 2019, 20:06
You need to format the code so we know what is the solution.
On first glance, the print(String s) method should print out the parameter s.
Your print() method is just printing "Hello".
0