Stark

Stark

Write a program on Generic Constructor.

4.A] Write a program on Generic Constructor. Answer: Generic Constructor in Java: A generic constructor in Java is a constructor that has one or more type parameters. These type parameters are independent of the generic parameters of the class and…

Write a note on ordinal() and compareTo()

2.C] Write a note on:i) ordinal()ii) compareTo() Answer: In Java, both ordinal() and compareTo() methods are commonly used with enumerations (enum) but can also be applied in other contexts. Here’s a detailed explanation of each: i) ordinal() ii) compareTo() Summary:…