Question: (14 points) Abstract Class exercise You are given two abstract classes with no abstract method in the NoGo.java file. The purpose of this exercise is
(14 points) Abstract Class exercise
You are given two abstract classes with no abstract method in the NoGo.java file. The purpose of this exercise is to get familiar with abstract class and its object creation.
NoGo.java below
package Assignment5_Abs_Interface_ExceptE.Student;
//Create a class as abstract without including any abstract methods(), and verify
//that you cannot create any instances of that class.
abstract class Nogo1 {
Nogo1() { System.out.println("Nogo1()"); }
}
abstract class Nogo2 {
// step 4
}
// step 2 here....
// step 5 here
public class NoGo {
public static void main(String[] args) {
// step 1 here: try to create objects for the two classes above
// step 3 here create a Go1 object..
// step 6 here
}
}
Follow the steps below: ( be sure common on each to score points)
1)(2 points) Use the NoGo.java file to show that you cannot create any instances (reference variables) of these two classes.
2)( 3 points) Create a subclass Go1 with Nogo1 as its super class and create Go1( ) constructor that print a Go1 ( ) message
3)(2 points) Now inside the NoGo class create an instance of Go1, you should be able to run it. What is the display? Please explain what happen.
4)(2 points) In Nogo2 class (abstract) add an abstract method as the following:
abstract void nMethod( );
5)(2 points) Create a new class Go9 that extends the Nogo2 class and overrides the nMethod ( ) method. The constructor for Go9( ) displays Go9( )
6)(2 points) In the Nogo class (the one with the main( ) ) , create an Go9 object and launch the nMethod()
Run NoGo program, You should see the following display: ( 1 points)
NoGo1()
Go1()
Go9()
get nMethod() out of abstraction
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
