CodeSteps

Python, C, C++, C#, PowerShell, Android, Visual C++, Java ...

constraints

Java – How to impose constraints on Generics in Java?

In our previous article, we discussed generics in Java. There are a few constraints that we can impose while working with Generics using extends and super keywords. The ‘extends’ keyword with respect to class Let’s create the Demo<T> class using extends keyword. class Demo<T extends Number> {        T value; } This implies that the class […]

Scroll to top
Exit mobile version