We have generics in java using which we can generalize a class. I know that Object class is the parent class of every class.
When I can typecast to and from Object then why generics are needed?
class Response<T>{
T data;
}
class Response{
Object data;
}
Both of the above code snippets will work the same way.