+ 1
I have an error on printDetail method
public class person { private String name; private int age; public person(String myName, int myAge) { name = myName; age = myAge; } public String getName()//1 { return name; } public int getAge() { return age; } public void setage(int age)//2 { this.age = age; } public void setName(String name) { this.name = name; } public void printDetails(String name) { System.out.println("the name of the person is: ","+name"); } public static void main(String[] args){ person p = new person("ali",12); } }
7 Answers
+ 1
System.out.println("the name of the person is: " + name);
Your print statement should look like this. I just changed it ans compiled the code. Got no error. đ
+ 1
abdullah for print statement, Proper way :
System.out.println("the name of the person is: "+name);
May you don't put full code.. Save code in playground and share link here.. That help you find answer quickly..
https://www.sololearn.com/post/75089/?ref=app
+ 1
Just remove the parantheses before and after + name.
0
I remove but the error was still not remove
0
Hmm
0
Ok thank you
0
The error was because i wrote " , " before +name