We would write a DAO class for managing Students like the following code: public class StudentDAO Here, Number is upper bound of the type parameter T. c) Generic methods are methods that introduce their own type parameters. b) Generic methods are the methods that extend generic class methods. What are generic methods a) Generic methods are the methods defined in a generic class. Writing Generic Classes in JavaSuppose that we are developing a database library called Data Access Object (DAO) for a program that manages resources in a university. This set of Java Multiple Choice Questions & Answers (MCQs) on Generic Methods. Why should we write generic code?The reason I tell you to write generic code is that generic code helps you save time and effort, in terms of avoiding redundancy and creating more reusable and more general API.Keep reading and you will see the power and robustness of writing generic code. generic classes and generic methods in Java. This tutorial helps you write your own generic stuffs i.e.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |