Question: Java lab questions: For every code, the question is commented out inside the code with // 1. package q01; public class Main { public static
Java lab questions:
For every code, the question is commented out inside the code with //
1. package q01; public class Main { public static void main(final String[] argv) { //implement the necessary classes // A::foo // B::foo A a = new A(); B b = new B(); a.foo(); b.foo(); } }
2. package q02; public class Main { public static void main(final String[] argv) { //implement the necessary methods and classes // A::foo // B::foo A a = new A(); B b = new B(); go(a); go(b); } } 3. package q03; public class Main { public static void main(final String[] argv) { //implement the necessary methods and class hierarchy // A::foo // B::foo // B::foo A aa = new A(); A ab = new B(); B bb = new B(); go(aa); go(ab); go(bb); } } 4. package q04; public class Main { public static void main(final String[] argv) { //implement the necessary method and class hierarchy // A::foo // B::foo // B::foo A aa = new A(); A ab = new B(); B bb = new B(); go(aa); go(ab); go(bb); } } 5. package q05; public class Main { public static void main(final String[] argv) { //implement the necessary interface, and class hierarchy // A::foo // B::foo // A::foo // B::foo // B::foo I ia = new A();//I ia an Interface I ib = new B(); A aa = new A(); A ab = new B(); B bb = new B(); go(ia); go(ib); go(aa); go(ab); go(bb); } private static void go(final I i) { i.foo(); } } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
