× Didn't find what you were looking for? Ask a question
Top Posters
Since Sunday
w
3
w
3
e
3
3
r
3
g
2
2
b
2
M
2
V
2
f
2
c
2
New Topic  
Stromile Stromile
wrote...
Posts: 299
Rep: 0 0
6 years ago
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
Read 59 times
1 Reply
Replies
Answer verified by a subject expert
StingerStinger
wrote...
Posts: 310
Rep: 4 0
6 years ago
Sign in or Sign up in seconds to unlock everything for free
1

Related Topics

Stromile Author
wrote...

6 years ago
Good timing, thanks!
wrote...

Yesterday
Just got PERFECT on my quiz
wrote...

2 hours ago
Helped a lot
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  342 People Browsing
 116 Signed Up Today
Related Images
  
 430
  
 276
  
 8080
Your Opinion
What percentage of nature vs. nurture dictates human intelligence?
Votes: 437

Previous poll results: Who's your favorite biologist?