Question: QUESTION 5 (a) An ArrayList is known as a Generic Class with a Generic type E. Give two examples of of an ArrayList with the

QUESTION 5 (a) An ArrayList is known as a Generic Class with a Generic type E. Give two examples of of an ArrayList with the concrete types String and Integer. (4 marks) (b) Can a subclass override the visibility/accessibility of a method from its Superclass? Explain your answer. (5 marks) (c) The following code will throw an error. What type of error will be thrown and what will be output on the console when attempting to run this program. public class Quotient { public static void main(String[] args) { int number1 = 1; int number2 = 0; System.out.println(number1 + "/" + number2+" is " + (number1 / number2)); } } (d) (4 marks) Add a method to the code from part c with the following header public static int quotient(int numberl, int number2). Use exception handling to handle the error. (7 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
