From the course: Java: Generic Classes
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Understand generics in Java - Java Tutorial
From the course: Java: Generic Classes
Understand generics in Java
- [Instructor] Let us now understand what is this generics feature all about. Generics in Java gives you a way to define parameterized types. This means that you can have classes and interfaces with parameters enabled on them. These kind of classes and interfaces exist in the Java APIs Today. You can also write such classes and interfaces of your own. Let us understand this better by comparing pre and post generics code of the ArrayList class from the collections API. Before the advent of generics the ArrayList definition looked like this, public class ArrayList and it is followed by an extends clause, and implements clause which is indicated by those dots on the slide, and then you have the curly pair of braces in which you have the entire code. But we are not concerned about those details. What we are interested in is this part at the beginning, public class ArrayList. After the generics feature got introduced in…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.