QUESTION 4: Object Orientation Analyse the following Java code segment and answer the questions that follow: 1| interface IMoveable { void move(); 3} 4 abstract class Insect implements IMoveable {...


Hi please assist


urgent


please verify each line


QUESTION 4: Object Orientation<br>Analyse the following Java code segment and answer the questions that follow:<br>1| interface IMoveable {<br>void move();<br>3}<br>4 abstract class Insect implements IMoveable {<br>private final int ID;<br>/* remainder of class omitted */<br>7 }<br>8 class Fly extends Insect {<br>public void move() { System.out.println(
sims = new ArrayList<>(); sims.add(new Fly()); sims.add(new Ant()); for(IMoveable sim: sims) { sim.move(); } } 17 18 19 20 21 22 23 24 25 } Identify five (5) unique Java programming constructs/principles in the code above. List the line number and the programming constructs/principles, for example: Line 99 - Exception Handling. "/>
Extracted text: QUESTION 4: Object Orientation Analyse the following Java code segment and answer the questions that follow: 1| interface IMoveable { void move(); 3} 4 abstract class Insect implements IMoveable { private final int ID; /* remainder of class omitted */ 7 } 8 class Fly extends Insect { public void move() { System.out.println("I am flying but I can walk too."); } /* remainder of class omitted */ 11} 2 9 10 12 class Ant extends Insect { public void move() { System.out.println("I am walking."); } /* remainder of class omitted */ 15} 13 14 16 public class InsectSim { public static void main(String... args) { ArrayList sims = new ArrayList<>(); sims.add(new Fly()); sims.add(new Ant()); for(IMoveable sim: sims) { sim.move(); } } 17 18 19 20 21 22 23 24 25 } Identify five (5) unique Java programming constructs/principles in the code above. List the line number and the programming constructs/principles, for example: Line 99 - Exception Handling.

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here