Question

Debugging Exercise 10-2 

Debugging Exercise 10-2 0 Instructions DebugExtende... DebugTen2.java DebugVacatio... + >- Terminal LU 1 public class Debug EDebugging Exercise 10-2 0 x 1 structions DebugExtende... DebugTen2.java DebugVacatio... + > Terminal + 1 // A Vacation is 10Debugging Exercise 10-2 0 Instructions DebugExtende... Debugten2.java DebugVacatio... + >- Terminal 1 public class DebugVacat


1 0
Add a comment Improve this question Transcribed image text
Answer #1

DebugVacation.java

public class DebugVacation {
   protected int days;
   public DebugVacation()
   {
       days=10;
   }
   public int getDays()// mathod name is getDays()
   {
       return days;
   }

}

DebugExtendedVacation.java

public class DebugExtendedVacation extends DebugVacation //if you want to use inheritance
// we need to use the key word extends
{ //ischildOff replae by extends
   public DebugExtendedVacation()
   {
       days=30;
   }

}

DebugTen2.java

public class DebugTen2 {
   public static void main(String args[])
   {
       DebugVacation myVacation=new DebugVacation();
       DebugExtendedVacation yourVacation=new DebugExtendedVacation();
      
       System.out.println("My vacation is for "+myVacation.getDays()+" days");
       System.out.println("Your vacation is for "+yourVacation.getDays()+" days");
      
   }

}

D DebugExtendedVacation.java D DebugTen2.java X D DebugVacation.java 1 package debug; 3 public class DebugTen2 { public stat

Add a comment
Know the answer?
Add Answer to:
Debugging Exercise 10-2
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT