Consider the following classes: public class A { private int myNum; public A(int x) { myNum = x; } public int getNumber() { retu
rn myNum; } public String getLetters() { return "A"; } public String getMessage() { return this.getLetters() + "-" + this.getNumber(); } } public class AB extends A { public AB(int x) { super(x + 1); } public int getNumber() { return super.getNumber() + 1; } public String getLetters() { return "AB"; } } What is the output of the following code segment? A test = new AB(0); System.out.print(test.getMessage());
The description of the java program can be given as:
In this program firstly we define a class that is "A". In this class, we define a private integer variable that is "myNum" and parameterized constructor and pass an integer variable that is "x" and use a private variable to holds the constructor variable value.Then we define three function that is "getNumber(), getLetters() and getMessage()" this function we returns values.
Then we define another class that is "AB" which inherits the base class "A". In this class we define parameterized constructor and two methods that is "getNumber() and getLetters()". In the parameterized constructor and getNumber() method we use a super keyword that calls above(base class methods) and increases the value by 1. In getLetters() method we return value that is "AB".
In calling time we create a class object that is "test", and call the AB class and pass value 0 in the parameter, and call the getMessage() method.
The central point of Christian belief is that God, the Father, entered into human history as the Son, Jesus of Nazareth, and arose as the Holy Spirit. Christian Philosophy God is the Creator of the universe.