Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

12. What is the output of the following code fragment? //------- A obj=new A(); obj.x=15; Foo(obj); System.out.println(obj.z); System.out.println(obj.y); B obj2 = new B(7); Foo(obj2); obj2.w=obj.x+obj2.y;

image text in transcribed
image text in transcribed
12. What is the output of the following code fragment? //------- A obj=new A(); obj.x=15; Foo(obj); System.out.println(obj.z); System.out.println(obj.y); B obj2 = new B(7); Foo(obj2); obj2.w=obj.x+obj2.y; System.out.println(obj2.w); } public static void Foo(A OX 0.2=--O.x+o.y } public class A{ int x,y,z; int k=80; public A) { System.out.println(k); this.k=40; this.y=6; } } //-- public static void FOO(A OX O.Z=--O.X+o.y- } 1/--- public class A{ int x,y,z; int k=80; public A() { System.out.println(k); this.k=40; this.y=6; } } Il--- public class B extends A{ int w; int k=150; public A( int b){ super.k=b; System.out.println(this.k); } * }

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

Step: 3

blur-text-image

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions