Generics in Java: Creating Classes and Methods Using Generics
Java SE 15 | Intermediate
- 12 videos | 1h 39m 12s
- Includes Assessment
- Earns a Badge
Generics is a handy tool in Java that greatly increases the maintainability of your code by allowing you to reuse code, using the same class or method with different types of data. Furthermore, generics also convert runtime checks to compile-time checks, making your code less error-prone. In this course, learn how to use generics in Java to write reusable and maintainable code, exploring why generic code has several advantages over non-generic code. Get hands-on practice with creating and defining classes with generic type parameters. Investigate how these generic types can be used as types for member variables, input arguments to methods, and return values from methods. Moving along, implement generic methods where the generic type parameter is associated with the method rather than the class itself. When you're finished, you'll have a solid foundation in defining and working with generic classes and methods in Java.
WHAT YOU WILL LEARN
discover the key concepts covered in this courselist the advantages of writing generic code over non-generic coderecall the limitations on code reuse in non-generic classesrecall the limitations of using raw objects rather than generic typesimplement a class with generics for type safety and compile-time checksuse generic types as input arguments to methods and return values from methods
create non-parameterized objects from generic classesrecall the disadvantages of non-generic methodsparameterize the class definition to create generic methodsparameterize the method definition without parameterizing classesillustrate type inference with parameterized methodssummarize the key concepts covered in this course
IN THIS COURSE
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.Digital badges are yours to keep, forever.
YOU MIGHT ALSO LIKE
PEOPLE WHO VIEWED THIS ALSO VIEWED THESE