Innovasoft

(Quality Computer Training All Practical Fully demo based classes)

We will train the students on how to develop softwares

we teach you complete coding

Contact Sethu.J Mobile No. 9865863825
Contact Anand.P Mobile No. 9790874410

Java Programming ( object oriented programming )

Top quality computer course center in thanjavur for Java

	Java code Snippet to make a class with an implementation of Comparable Interface.
    
class Emp implements Comparable{ private String empname; private int age; private int sal; public Emp(String n,int a,int s){ empname = n; age = a; sal = s; } void show(){ System.out.println(empname+" "+age+" "+sal); } @Override public int compareTo(Object o) { Emp other = (Emp)o; //return empname.compareTo(other.empname); if (sal == other.sal && age == other.age) return empname.compareTo(other.empname); else return sal - other.sal; } }