public class Client {
public static void main(String args[]){
Malo e = new Malo();
e.setEid(11);
e.setEsalary(3000);
e.setEname("durga");
System.out.println(e);
}
}
when i create an object and pass the parameter with dot operator it is not working.It says that constructor is not defined
public class Client {
public static void main(String args[]){
Malo e = new Malo(11,3000,"del");
System.out.println(e);
}
}
but when i pass the parameter int the object creation line it works but why the above method is not working?
public class Malo {
int eid;
int esalary;
String ename;
//constructors
public Malo(int eid, int esalary, String ename) {
this.eid = eid;
this.esalary = esalary;
this.ename = ename;
}
public int getEid() {
return this.eid;
}
public void setEid(int eid) {
this.eid = eid;
}
public int getEsalary() {
return this.esalary;
}
public void setEsalary(int esalary) {
this.esalary = esalary;
}
public String getEname() {
return this.ename;
}
public void setEname(String ename) {
this.ename = ename;
}
@Override
public String toString() {
return "{" +
" eid='" + getEid() + "'" +
", esalary='" + getEsalary() + "'" +
", ename='" + getEname() + "'" +
"}";
}
}
This is my malo class and i declared as public