Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

Students also viewed these Databases questions