// A1 extended to Fri Noon. //Review of Musician and Band classes. Musician m1 = new Musician("Larry", 98); m1.getName() m1.getSalary() Musician m2 = new Musician("Curly", 82); Musician m3 = new Musician("Mo", 45); //creating a band Band b = new Band(m1, m2, m3); b.getTotalSalary() b.getMemberOne() b.getMemberOne().getName() b.getMemberOne().getSalary() //We also discussed toString method m1.toString() b.toString() //if you don't provide the toString() method, the default toString() method // (in Object class that returns the refrence in string format) is called //let's add a toString method to Band and try again Musician m1 = new Musician("Larry", 98); Musician m2 = new Musician("Curly", 82); Musician m3 = new Musician("Mo", 45); Band b = new Band(m1, m2, m3); b.toString() //discussed == for objects Musician m1 = new Musician("m1", 100) Musician m2 = new Musician("m1", 100) m1 == m2 //why false? Musician m3; m3 = m1 m1 == m3 //Similarly, for String equality "hello" == "hello" String s1, s2 s1 = "hello" s2 = "hello" s1 == s2 //why they are not equal? // note when using == for objects, we are comparing their references // it evaluates to true only if both sides of == refer to the same object. //here is to check the data equality of two Strings: "hello".equals("hello") s1.equals(s2) //if you want a special data equality for your class you need to implement a methods for that Musician m1 = new Musician("m1", 100) Musician m2 = new Musician("m1", 100) Musician m3 = new Musician("m1", 300) m1 == m2 m1.isEqual(m2) m1.isEqual(m3) //exercise: what happens if we try Band b = new Band(m1, m1, m1)? // what about b.getMemberOne()? b.totalSalary()?