+ 1

Error : Actual and formal argument lists differ in length 1 error.

I wrote a code in java. For the question :- Create A Class 'Student' With Three Data Members Which Are Name, Age And Address. The Constructor Of The Class Assigns Default Values Name As "Unknown", Age As '0' And Address As "Not Available". It Has Two Members With The Same Name 'SetInfo'. First Method Has Two Parameters For Name And Age And Assigns The Same Whereas The Second Method Takes Has Three Parameters Which Are Assigned To Name, Age And Address Respectively. Print The Name, Age And Address Of a Student. The code is taking input but while displaying an error is thrown as actual and formal argument lists differ in length. Please help. https://code.sololearn.com/cO8WJZkMKn2Q/?ref=app

28th Jun 2020, 8:27 AM
Monika
2 ответов
+ 6
Monika You have to make parameterized constructor because you have used s[i]= new Student(Name,Age,Address); Student(String name, int age, String add) { this.name = name; this.age = age; this.add = add; }
28th Jun 2020, 8:33 AM
A͢J
A͢J - avatar
+ 1
AJ Anant Thank you soo much it worked 💯👍
28th Jun 2020, 8:48 AM
Monika