+ 1
method
class MyClass { static void sayHello(String name) { System.out.println("Hello " + name); } static void rollno(int rollno){ System.out.println("rollno is"+ rollno); } public static void main (String args[]){ sayHello ("eshaan"); } public static void main (int rollno){ rollno("16543"); } } can any body tell me why this code not running
5 Answers
+ 2
try to replace 2nd main by calling
rollno(16543);
+ 1
because of 2 main methods!
it must be only one main in the whole program
+ 1
okk thanku very much
0
can you please explain it by writing
0
/*your trying to turn an int to string heres your working code*/
class MyClass {
static void sayHello(String name) {
System.out.println("Hello " + name);
}
static void rollno(int rollno){
System.out.println("rollno is "+ rollno);
}
public static void main (String args[]){
sayHello ("eshaan");
rollno(1234);
}}