Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Given the following class definitions:
Public abstract class A2{
private int x;
public A2 (int a) {
this.x=a;
}
public int getX(){
return this.x;
}
public abstract double sameInfo();
}
public class B2 extends A2 {
private int y;
public B2 (int a, int b) {
super(a);
this.y = b;
}
public int getY () {
return this.y;
}
public double someInfo () {
return 100 * y;
}
}
public class C2 extends A2 {
private int z;
public C2 (int z){
super(5);
this.z=z;
}
public int getZ() {
return this.z;
}
public double sameInfo() {
return 100 * z * getZ();
}
}
public class D2 extends B2 {
public D2 (int D) {
super(10,20);
}
public double sameInfo () {
return 100 * getY() * getX();
}
}
You may assume that the following statements precede those in the table below:

A2 a1, a2 = new B2(2, 4);

B2 b1, b2 = new B2 (4, 6);

C2 c1, c2 = new C2 (5);

D2 d1, d2 = new D2 ();

1- The following statement:

b1= new A2(10);

Answer

A. Produce no error

B. Produces a SYNTAX (or compile-time) error

C. Produces an EXCEPTION (or run-time error)

D. Produces a LOGIC error

2- The following statement:

b2 = new D2();

Answer

A. Produce no error

B. Produces a SYNTAX (or compile-time) error

C. Produces an EXCEPTION (or run-time error)

D. Produces a LOGIC error

3- The following statement:

a2.getY();

Answer

A. Produce no error

B. Produces a SYNTAX (or compile-time) error

C. Produces an EXCEPTION (or run-time error)

D. Produces a LOGIC error

4- The following statement:

a2.someInfo();

Answer

A. Produce no error

B. Produces a SYNTAX (or compile-time) error

C. Produces an EXCEPTION (or run-time error)

D. Produces a LOGIC error

5- The following statement:

((D2)b2).getY();

Answer

A. Produce no error

B. Produces a SYNTAX (or compile-time) error

C. Produces an EXCEPTION (or run-time error)

D. Produces a LOGIC error

6- The following statement:

d1 = new B2(5,6);

Answer

A. Produce no error

B. Produces a SYNTAX (or compile-time) error

C. Produces an EXCEPTION (or run-time error)

D. Produces a LOGIC error

Java, Programming

  • Category:- Java
  • Reference No.:- M91610947
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Java

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Object-oriented software development1 introduction 11

OBJECT-ORIENTED SOFTWARE DEVELOPMENT 1. Introduction 1.1 Assignment Requirement 1.2 Deliverables and Structure (what to submit) 1.3 Software Restrictions 1.4 How to score high... 1.5 Assumptions 2. System Requirements 2. ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As