1,105,177 Community Members

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

Member Avatar
agmolina90
Newbie Poster
8 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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;   
    }
}
Member Avatar
Ezzaral
Posting Sage
7,431 posts since May 2007
Reputation Points: 2,714 [?]
Q&As Helped to Solve: 953 [?]
Skill Endorsements: 31 [?]
Moderator
Featured
 
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(...) .

Member Avatar
agmolina90
Newbie Poster
8 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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: