Consider the following class: //class M public abstract clas…

Consider the following class: //class M public abstract class M { private int n; protected double p; public abstract void foo1(); } //end class M   Answer the following questions: 1. If you code the following class: public class P extends M { }    When you compile the code, what is the result? 2. If you code the following class: public class P extends M { public void foo1() { System.out.println(“n is: ” + n); } } When you compile the code, what is the result? 3. If you code the following classes, P and Q: public class P extends M { public P(double newP) { p = newP; } public void foo1() { } }//end class P   public class Q extends P { private int z; public Q(double newP, int newZ) { z = newZ; super(newP); } } When you compile the code, what is the result?

You have a tryblock that might throw a user-defined exceptio…

You have a tryblock that might throw a user-defined exception TooYoungException or any type of Exception . Put these exceptions in the correct order in the catch blocks       try      {      // statements which might throw any type of Exception      // or TooYoungException      }            catch ([b1]  ex )      {      // statements to handle this      // type of exception      }            catch ([b2]   ex  )      {      // statements to handle this      // type of exception      }      // Statements following the structure

Consider the following two classes:   And assuming that the…

Consider the following two classes:   And assuming that the following variable has been declared: Car mycar = new Truck(); 1. What is the output or result from the following statement? mycar.m1();  2. What is the output or result from the following statement? mycar.m2();