list[0] = new String (“Sandy”); list[1] = new String (“Mandy”); list[2] = new String (“Jony”);
class Height { int feet,inches; Height(){} Height(int f,int in) { feet=f; inches=in; } Height getDifference(Height ref) { int df=Math.abs((feet*12+inches)-(ref.feet*12+ref.inches)); Height dfObj= new Height(df/12,df%12); return (dfObj); } public String toString() { return(“Feet:”+feet+” Inches:”+inches); } } class PasRetOb { public static void main(String args[]) { Height aman,raman; aman=new Height(5,8); raman=new Height(4,7); Height diff=raman.getDifference(aman); System.out.println("Difference:"+diff); } }