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

  How does a marketer balance the short-term gains

How does a marketer balance the short-term gains that sales promotion can deliver against the possible negative long-term consequences such promotions might have for brands? Use appropriate examples.

  Java test program

Write a Java test program, all your code should be in the main method, that determines what type of organization is indicated by a web address. Your program should allow the user to enter a web address

  Loops-for loop, while loop, and do while loop

There are 3 kinds of loops-for loop, while loop, and do while loop. Under which circumstances would each kind of loop be more appropriate

  Button to increase or decrease the number of the balls

Simulates a bouncing ball. Extend to allow mulitple balls. You can use the +I or -I button to increase or decrease the number of the balls and use teh Suspend and Resume buttoms to freeze the balls or resume bouncing. For each ball, assign a random c..

  Create a splash screen for the tgc application

To complete your splash screen please use the information below: Create a splash screen for the TGC application that displays: the application's name.

  Write a program that reads a set of floating-point

Write a program that reads a set of floating-point data values from the input.

  Inheritance involves the concept of super class

Inheritance involves the concept of super class (parent class) and sub class (derived class). What is a super class in Java? What is a sub or derived class in Java?

  Implement bounded partial queue using signaling mechanism

Can you explain the reason? You can run the experiments on ecen5033.colorado.edu. Submit the code as well as experimental results - Implement both these schemes in Java. Each of the methods foo() and bar() just sleeps for 20 milliseconds.

  Using the java development kit and jgrasp

Using the Java Development Kit and jGrasp, develop a program in response to the following prompt:

  A method and using a synchronizedblock

What'sthe difference between synchronizing on a method and using a synchronizedblock?

  Define inventory program assignment from java class

This is part 6 of the inventory program assignment from Java class IT 215 from UOP and all the codes are written well and includes everything all the functionality from the previous parts and there's absolutely no errors.

  Design an application to take and process a pizza order

Design an application to take and process a pizza order. The user should be able to make pizza order choices from list boxes, and the application should display the order price.

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