/** * Demonstrates overload variant method selection. * Java picks the most specific type match. */ public class Singing { void sing ( Object lyrics ) { speak ( lyrics.toString() ); } // overloads sing void sing ( Midi song ) { song.play(); } public static void main( String[] args ) { // use Midi overloaded version because Midi in more specific than Object sing ( new Midi( "Ain't We Got Fun" ) ) } }