Are generics fully functional...?

Consider the snippet,

Vector <String>strObject = new Vector <String>();

Now adding an int or any other type of object into this collection would throw a compile time error, which sounds good...!
//strObject.add(12) -- Compilation error

On the other hand,
Vector newVector = strObject;

This doesn't throw any compilation errors rather, you see a warning to recompile with -Xlint, which many a times we ignore....!

No comments:

Tired of seeing that 500 Bad gateway error while deploying a Springboot application in AWS...?

By default, Spring Boot applications will listen on port 8080. Elastic Beanstalk assumes that the application will listen on port 5000. Th...