1.11M Members

Ok, I almost got it :) ...almost

 
0
 

Ok, I have no idea how to use a class I created its probably really simple but I still cant figure it out

Person employee = new Employee("Tom Jones", "777 B Street", "408-888-9999", "tj@xyz.com", "Room 221", "$30450", (2, 8, 1987));

I am trying to use this with this class I created but I keep getting an error:

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - no suitable constructor found for Employee(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,int,int)
constructor Employee.Employee(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,MyDate) is not applicable
(actual and formal argument lists differ in length)
constructor Employee.Employee() is not applicable
(actual and formal argument lists differ in length)
at test.main(test.java:20)

AND HERE IS THE CLASS I AM USING, THanks for looking.

public class MyDate{
    private int month, day, year;
    
    public MyDate(){
    }
   
    public MyDate(int month, int day, int year){
        this.day = day;
        this.month = month;
        this.year = year;   
    }
}
 
2
 

If you want to pass an instance of your MyDate class as a parameter, you'll need to create it with 'new' keyword: new MyDate(...) .

 
0
 

If you want to pass an instance of your MyDate class as a parameter, you'll need to create it with 'new' keyword: new MyDate(...) .

Thank You so much, that was it perfect,

Question Answered as of 2 Years Ago by Ezzaral
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: