Question
What will be the output of the following code given below? Upload the output of the program import java.util.Arrays; public class Employee implements Comparable {
What will be the output of the following code given below? Upload the output of the program import java.util.Arrays; public class Employee implements Comparable { int id; String name; double sal; public Employee() { } //parametric constructor public Employee(int id,String name,double sal) { this.id=id; this.name=name; this.sal=sal; } //I'm going to use the toString method of the java public String toString() { return "ID "+id+" Name "+name+" Salary "+sal; } @Override public int compareTo(Employee o) { /* if((this.name).compareTo(o.name)>0) return 1; if((this.name).compareTo(o.name)<0) return -1;*/ if(this.sal>o.sal) return 1; if(this.sal
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started