Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class XYZ { private int myNum; public XYZ() { myNum=0; } public XYZ(int n1) { myNum=n1; } } public class ABC extends XYZ {

public class XYZ {

private int myNum;

public XYZ() {

myNum=0;

}

public XYZ(int n1) {

myNum=n1;

}

}

public class ABC extends XYZ {

private int num2;

public ABC() {

myNum=0;

num2=0;

}

pubilc ABC(int n1) {

myNum=n1;

num2=n1*2;

}

}

class Main {

public static void main(String[] args) {

ABC myABC = new ABC();

}

}

public class XYZ {

private int myNum;

public XYZ() {

myNum=0;

}

public XYZ (int n1) {

myNum = n1;

}

}

public class ABC : XYZ {

private int num2;

public ABC() {

myNum=0;

num2=0;

}

public ABC (int n1) {

myNum = n1;

num2 = n1*2;

}

}

class MainClass {

public static void Main (string[] args) {

ABC myABC= new ABC();

}

}

Question 4 options:

myNum is defined as private in XYZ and as such is inaccessable in ABC.

class ABC cannot have private attributes because it's inheriting from XYZ

class ABC is not allowed to inherit from class XYZ

You cannot instantiate an object of type ABC, you can only instantiate objects of type XYZ

left side is java , right side is c#
why does code not compile is the question

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

Students also viewed these Databases questions

Question

a. How many different groups were represented?

Answered: 1 week ago

Question

=+you think is being taxed when more money is printed? Why?

Answered: 1 week ago