Skip to main content

Posts

Showing posts with the label Interface

Write an interface called Playable, with a method void play(); Let this interface be placed in a package called music. Write a class called Veena which implements Playable interface. Let this class be placed in a package music.string Write a class called Saxophone which implements Playable interface. Let this class be placed in a package music.wind Write another class Test in a package called live. Then, a. Create an instance of Veena and call play() method b. Create an instance of Saxophone and call play() method c. Place the above instances in a variable of type Playable and then call play() Interfaces

Write an interface called Playable, with a method void play(); Let this interface be placed in a package called music.  Write a class called Veena which implements Playable interface. Let this class be placed in a package music.string  Write a class called Saxophone which implements Playable interface. Let this class be placed in a package music.wind  Write another class Test in a package called live. Then, a. Create an instance of Veena and call play() method b. Create an instance of Saxophone and call play() method c. Place the above instances in a variable of type Playable and then call play()  Interfaces //if you have any alternate method comment down below. import music.Playable; import music.string.Veena; import music.wind.Saxophone; public class Test { public static void main(String[] args) { Veena v = new Veena(); v.play(); Playable p = new Veena(); p.play(); Saxophone s = new Saxophone(); s.play(); Playable ps = new Saxoph...