Forum : Error in the below program
Brief description  about Online courses   join in Online courses
View Nivetha  Ganapathy 's Profile

Error in the below program

I dont understand why do I get the error for the below code.
class Details {
String name [];
int age = 0;

void name_detail (String name1 []) {
name = name1;

}

void age_detail (int age1) {
age = age1;
}

void mydetails () {
System.out.println ("My name is :" name);
System.out.println ("My age is :" age);
}
}

class Mydetails {

public static void main (String args []) {

Details d1 = new Details ();

d1.name_detail("nivetha");
d1.age_detail(22);
d1.mydetails ();
}
}

Error:
Mydetails.java:26: name_detail(java.lang.String[]) in Details cannot be applied
to (java.lang.String)
d1.name_detail("nivetha");
^
1 error

Please help
Asked by Nivetha Ganapathy | Mar 31, 2010 |  Reply now
Replies (1)
View arun kumar das 's Profile
Hi Nivetha,

I am getting a different set od errors other than the one mentioned by you. So, please mail me your program in a notepad along with screenshot of the error you have got. I will debug and give you the explanation of the errors.

Cheers...
Java Teacher
Apr 3, 2010