Skip to content

Opening book details…

Can I read Java Abstract Class with Generics on EtoBox?

Java Abstract Class with Generics by Yashaswi Piplani is a document available to read on EtoBox.

What is Java Abstract Class with Generics about?

This document discusses implementing an abstract class that implements the Comparable interface with generics in Java. The original poster wants subclasses to only accept objects of their own type in compareTo(), rather than the superclass type. Several solutions are proposed using generics and type parameters, but they have limitations. It is noted that forcing subclasses to implement compareTo() may not make sense, and coding to interfaces is preferable to classes.

Author
Yashaswi Piplani
Language
EN