Error

+1 Arnab Banerjee · January 28, 2015
What is the error n the following code ?


import java.util.*;
public class prog4{
public static void main(String args[]){
System.out.println("What is your name? ");
cl1 obj1 = new cl1("Arnab", "Banerjee");
obj1.ans();

}
}

public class cl1{
public String nm1;
public String nm2;
public void cl1(String name1, String name2){
nm1 = name1;
nm2 = name2;
}
public String getName(){
return nm1;
return nm2;
}
public void ans(){
System.out.printf("Your name is %s %s \n" ,  getName());
}
}

Post a Reply

Replies

Oldest  Newest  Rating
+1 Arnab Banerjee · January 28, 2015
YA I was using notepad++, it wasn't giving me such error when I was running it with cmd, ok let me try it again, using two different functions.
+1 Arnab Banerjee · January 28, 2015
nope.
  • 1

Java / Android Development

107,260 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator