Question 8
Consider the Java code given below.
interface Operable { void operate();}class Robot implements Operable { public void operate() { System.out.println("Operating Robot"); }}class Drone implements Operable { public void operate() { System.out.println("Operating Drone"); }}class MachineShop { private Object[] oArr = new Object[]{new Robot(), new Drone(), "String Object"}; public void operateMachines() { for (int i = 0; i < oArr.length; i++) { // LINE X } }}public class TestMachines { public static void main(String[] args) { MachineShop mShop = new MachineShop(); mShop.operateMachines(); }}Identify the appropriate option to fill in place of LINE X such that the output is:
Operating Robot
Operating Drone