Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3 0 4 pts What would be the output values for c 2 . x and c 2 . y ? c 2 .

Question 30
4 pts
What would be the output values for c2.x and c2.y?
c2.x: , c2.y:
class
int x=0;
int y=0;
}
class C2 extends C1{
int y=4;
}
class MyProg {
public static void main(String[] args){
C1c= new C2);
c.x=2;
c.y =2;
C2c2=(C2)c;
System.out.println(c2.x+","+ c2.y);
}
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions