Question: Fast please Section B: Short Answer Questions (5 questions x 10 marks = 50 marks) Answer 5 questions ONLY. If you answer more than 5

Fast please
Fast please Section B: Short Answer Questions (5 questions x 10 marks

Section B: Short Answer Questions (5 questions x 10 marks = 50 marks) Answer 5 questions ONLY. If you answer more than 5 questions, the first 5 questions will be marked. B1. Answer the following questions: a. Given: class A public String toString() { return "A object"; ) class C extends B public String toString() { return "Cobject"; class B extends A public String toString() { return "B object"; } ) What is the output of executing the following Test program? [7 marks] public class Test public static void main(String[] args) { Object x1 = new A(); System.out.println(x1.toString()); Object x2 = new B(); System.out.println(x2.toString(); Object x3 = new C(); System.out.println(x3.toString()); A a = new C(); System.out.println(a.toString()); Bb = new C(); System.out.println(b.toString()); C c = new C(); System.out.println(c.toString()); b. Explain the different purposes of using the final keyword in the following declarations: [3 marks] final class Math final double PI = 22.0 / 7.0; final int maximum (int x, int y)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!