Find the errors in the code

Assignment Help JAVA Programming
Reference no: EM13940073

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

Reference no: EM13940073

Questions Cloud

Compute the order point : Xander Company anticipates that usage of Component T will be 100 units daily, which equates to around 25,000 for the year. Compute the order point. Determine the most economical order quantity
Different stakeholders involved in this form of tourism : Who are the different stakeholders involved in this form of tourism? For example consumers, communities, industry enterprises, governments, non-government organisations.
How many units must be sold to earn operating income : How many units must be sold to earn operating income of $300,000? Compute the additional operating income that Rad-Brad's would earn if sales were $50,000 more than expected.
What is the difference between a union shop and agency shop : What is the difference between a union shop and agency shop? How do these operate in a right-to-work state?
Find the errors in the code : You may assume that the following statements precede those in the table below:
The anatomical theory of disease : Write a 2-3 page paper and briefly describe and compare the following: the humoral concept of disease, the anatomical theory of disease, and the germ theory. How does each differ from the other? What is the historical significance of each on the c..
Variety of ethical dimensions to the responses : There are a wide variety of ethical dimensions to the responses of individuals (such as scientists, politicians, environmental activists, journalists, and  "normal" people) and organisations  (e.g. Government, business and the media) to the inform..
What is the dollar amount of purchase of suits : What is the dollar amount of purchase of suits? Each suit has a cost of $80.
Assuming that the salaries of production managers : A sample of 9 production managers with over 15 years of experience has an average salary of $71,000 and a sample standard deviation of $18,000.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd