Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What will happen when you compile and run the following code? class Parent { public static void print ( int i ) { System.out.println (

What will happen when you compile and run the following code?
class Parent {
public static void print(int i){
System.out.println("Parent");
}
}
class Child extends Parent{
public static void print(byte b){
}
system.out.println("Child");
}
public class Test {
public static void main(String args[]){
Parent one = new Child();
one.print(10);
}
.
a. Parent
b. Compilation Error
C. Runtime Error
d. Child
image text in transcribed

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

If none of the solutions seem satisfying, pick the more easier one.

Answered: 1 week ago

Question

You are to meet him on friday at the un building in nyc.

Answered: 1 week ago