filmov
tv
Java OOP - Generic Methods - Q3, Q4, and Q5
Показать описание
A recording of me working on some basic / introductory tutorial questions on Generic Methods: Q3, Q4, and Q5 (questions below). Overloading and User Defined Exceptions are also discussed.
Q3. Write a generic method, namely printArray, to print the contents of an array. Write a tester class that uses the printArray method to print the contents of an array of Integers; array of Doubles; array of Characters; and array of Strings.
Q4. Overload the generic method printArray, created for the above question 3, so that it takes two additional integer arguments, from and to. A call to this method prints only the designated portion of the array [Elements of the array between from and to index (inclusive of both from and to)].
Note: You need to validate from and to. If either is out of range, the overloaded printArray method should throw an InvalidSubscriptException; otherwise, printArray should print the elements accordingly.
Q5. Create a tester class to test the overloaded generic method printArray.
Moose's Software Valley - Established July, 1996.
Q3. Write a generic method, namely printArray, to print the contents of an array. Write a tester class that uses the printArray method to print the contents of an array of Integers; array of Doubles; array of Characters; and array of Strings.
Q4. Overload the generic method printArray, created for the above question 3, so that it takes two additional integer arguments, from and to. A call to this method prints only the designated portion of the array [Elements of the array between from and to index (inclusive of both from and to)].
Note: You need to validate from and to. If either is out of range, the overloaded printArray method should throw an InvalidSubscriptException; otherwise, printArray should print the elements accordingly.
Q5. Create a tester class to test the overloaded generic method printArray.
Moose's Software Valley - Established July, 1996.
Generics In Java - Full Simple Tutorial
Java generics ❓
Java Generics Tutorial
83 What is generics in java? #interviewquestions #javaprogramming #javaclass
Java Programming Tutorial - 30 - Generic Methods, Generic Data Type
Generics in Java
Java Generics Explained: Classes, Methods, Interfaces, Enums, & Exceptions | Full Tutorial
Java - Generic Method & Class
What is a generic type? - Cracking the Java Coding Interview
Generic Methods in Java 2019
How to write generic method in java | Rules to follow While Writing Generic method
What is Generics in #Java
Java Generics Tutorial
Java Generics Explained
Java - Generics Method
Java Programming Generics Class and Inheritance
Abstract Classes and Methods in Java Explained in 7 Minutes
Java Generics
Java Generics Tutorial
This is how Generics in Java actually work
Java Generic Bounded Types - Bounded Generic Types - Using extends in Generics
Generic Lists (Java OOP 6)
Generics in JAVA | Type of Generics | Java Tutorial for Beginners | Great Learning
Hands-on Java - Creating a Generic Class - Day 22
Комментарии