Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Determine the output of the following Java program consisting of the files: Itype.java, Atype.java, Btype.java and ItypeTest. java. Assume that all files are in the
Determine the output of the following Java program consisting of the files: Itype.java, Atype.java, Btype.java and ItypeTest. java. Assume that all files are in the same directory. // Itype.java interface Itype{ void foo () ; } // Atype.java class Atype implements Itype{ public void foo(){ System.out.println("in Atype's foo()"); } public String toString(){ return "I am an Atype object"; } } // Btype.java class Btype extends Atype{ Btype(){ System.out.println("constructing a Btype object"); } public void foo(){ System.out.println("in Btype's foo()"); } public void bar()(System.out.println("in Bytpe's bar()"); } public String toString(){ return "I am a Btype object"; } } // ItypeTest.java class ItypeTest{ public static void main(String[] args){ Itype I; Atype A; Btype B; A = new Atype(); B = new Btype(); I = A; A = B; I. foo (); A. foo () ; B.bar () ; System.out.println(I) ; System.out.println(A); System.out.println(B) ; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started