Multiple Choice
"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 the above
Correct Answer:

Verified
Correct Answer:
Verified
Q17: An int array stores the following values.
Q20: An int array stores the following values.
Q21: A polymorphic reference can refer to different
Q49: What are the main programming mechanisms that
Q50: Choosers-like file choosers and color choosers-provide a
Q51: Which of the following statements is completely
Q53: Consider this statement: If you declare a
Q55: Can a program exhibit polymorphism if it
Q58: Write the code needed to set up
Q59: A JSlider, xSlider, is used to change