Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i am trying to code toString statement. i am getting the error in blue j when i compile constructor Employee in class cannot be applied

i am trying to code toString statement. i am getting the error in blue j when i compile

constructor Employee in class cannot be applied to given types

required java.lang string .int manager found: int,java,lang String

resason: actual argument int cannot be converted to java.lang.String by method invocation conversion,

my class code

public class Employee { // instance variables private String name; private int id; private Manager manager;

/** * Constructor for objects of class Employee */ public Employee( String name,int id, Manager manager) { // initialise instance variables super(); this.name = name; this.id = id; this.manager = manager; } /** * Getter for theemployee's manager. */ public Manager getManager() { return this.manager; } /** * Setter for a employee's manager. */ public void setManager(Manager manager) { this.manager = manager; }

/** * Getter for a employee's name. */ public String getName() { return this.name; } /** * Setter for a employee's name. */ public void setName(String name) { this.name = name; } /** * Getter for a employee's id. */ public int getId() { return this.id; } /** * Setter for a employee's id. */ public void setId(int id) { this.id = id; }

/** * Returns a string describing this object. */ @Override public String toString() { return name+" "+id+" "+manager; } // public static void main(String args[]){ Employee e1= new Employee(01,"Ari","John"); Employee e2=new Employee(02,"Jon","John"); System.out.println(e1); System.out.println(e2); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions