Question: java C. Create and assign an object of Person using anonymous inner class for both of Line 7 and 8 to produce output Hello, I'm
java
C. Create and assign an object of Person using anonymous inner class for both of Line 7 and 8 to produce output Hello, I'm an Engineer" from line number 10 and "Hello, I'm a Doctor" from Line number 11. 1 interface Person { 2 void introduce(); 3) 4 5 public class AnnonEx { 6 public static void main(String[] args) { 7 Person engineer; // Write your codes 8 Person doctor; // Write your codes 9 10 engineer.introduce(); // should print "Hello, I'm an Engineer" 11 doctor.introduce(); // should print "Hello, I'm a Doctor" 12 } 13} Page 1 of 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
