Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class A{ static final int x = 5; static int y = 5; static void print() { System.out.println(x is +x+ and y is +y); }

image text in transcribed
class A{ static final int x = 5; static int y = 5; static void print() { System.out.println("x is "+x+" and y is "+y); } } class B extends A{ static final int x = 4; static int y = 4; static void print() { System.out.println("x is "+x+" and y is "+y); } class C { public static void main(String[] args) { A a = new B(); a.print(); } } O Program compiles and prints "x is 5 and y is 5" O Program compilcs and prints "x is 4 and y is 5" O Program has a compilation crror Program compiles and prints "x is 4 and yis 4

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 Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago