Which code fragment, when inserted at line 2, enables the code to compile?
A.
import sales.*;
B.
import java.sales.products.*;
C.
import sales;
import sales.products;
D.
import sales.*;
import produc...
What is the result?
A. Sum is 600
B. Compilation fails at line n1.
C. Compilation fails at line n2.
D. A ClassCastException is thrown at line n1.
E. A ClassCastException is thrown at line n2.
Which two options fail to compile when placed at line n1 of the main method?
A. employee.salary = 50_000;
B. director.salary = 80_000;
C. employee.budget = 200_000;
D. manager.budget = 1_000_000;
E. ...
Which code fragment should you use at line n1 to instantiate the dvd object successfully?
A.
super.r = r;
this.c = c;
B.
super(r);
this(c);
C.
super(r);
this.c = c;
D.
this.c = r;
super(c);
What is the result?
A.
int sum is 30
float sum is 30.0
B.
int sum is 30
double sum is 30
C.
Integer sum is 30
double sum is 30.0
D.
Integer sum is 30
float sum is 30.0
You are asked to develop a program for a shopping application, and you are given the following information. Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?