Multiple Choice
Given the following code, class Aggregate is incorrect. Choose the correct line so that this program prints: Granite: weight=25.0 value=4 numKind=7 public class Inherit
{
Abstract class Stone
{
Protected float weight = 13;
Protected int value = 4;
Abstract public String toString( ) ;
}
Class Aggregate
{
Protected int numKind;
}
Class Granite extends Aggregate
{
Granite()
{
Weight = 25; numKind = 7;
}
Public String toString()
{
Return "Granite: weight="
+ weight + " value="
+ value + " numKind="
+ numKind;
}
}
Inherit()
{
Granite g = new Granite( ) ;
System.out.println(g) ;
}
Public static void main(String[] args)
{
New Inherit() ;
}
}
A) abstract class Aggregate {
B) abstract class Aggregate extends Granite {
C) abstract class Aggregate extends Stone {
D) class Aggregate extends Stone {
E) None of these
Correct Answer:

Verified
Correct Answer:
Verified
Q28: The binary search can be used on
Q29: An class reference can refer to any
Q30: Although insertion sort and selection sort have
Q31: An interface reference can refer to any
Q32: Code Example Ch 10-1<br>An int array
Q34: A method's parameter can be polymorphic, giving
Q35: What does the following code do? Assume
Q36: It is possible to sort an array
Q37: In order to determine the type that
Q38: To swap the 3rd and 4th elements