Rajbal Balan

Greenhorn
+ Follow
since Nov 01, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rajbal Balan

Matthew Brown wrote:By the way, I think the way to turn your runtime exception into a compile-time error is to declare it like this:
Because Integer implements Comparable<Integer>, and String implements Comparable<String>, option A will no longer compile because they can't be compared with each other. The problem with the example given is that's it's partly generic, but it hasn't gone all the way.



Hi,

Could you please explain this in a little more detail how this declaration would help the compiler to catch the Integer-String comparison, preferable plugging in Integer/String into the declaration.

TIA.