Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started