5.
Given the class below, what will be the output when creating two Employee objects with different parameters and printing their details?
class Employee {
String name;
double salary;
public Employee(String name, double salary) {
this.name = name;
this.salary = salary;
}
public void printInfo() {
System.out.println(name + " earns $" + salary);
}
}
public class Test {
public static void main(String[] args) {
Employee e1 = new Employee("Alice", 50000);
Employee e2 = new Employee("Bob", 60000);
e1.printInfo();
e2.printInfo();
}
}