Blog Archives

01: 7 rules to remember on Java Generics for better understanding

Here are 7 rules to remember regarding Java Generics to understand Generics and handle interview and coding questions on Core Java. Object <– Fruit <– (Orange, Mango, etc siblings) Rule 1: Java generics differ from C++ templates. Java generics (at least until JDK 8), … Read more ›...

03: 12 Java Generics interview Q&As

Q1 What do you understand by the term type erasure with regards to generics? A1. The term type erasure is used in Java generics. In the interest of backward compatibility, robustness of generics has been sacrificed through type erasure. Type erasure takes place at compile-time. … Read more ›...

04: 5 Java generics Interview Q&As on wildcards with examples

Q1. If java.lang.Object is the super type for java.lang.Number and, Number is the super type for java.lang.Integer, am I correct in saying that List<Object> is the super type for List<number> and, … Read more ›...

05: Overloaded methods Vs Generic methods in Java with JD-GUI & javap to look under the covers

In an earlier post we looked at Understanding Overriding, Hiding, and Overloading in Java?. We also discussed how “method overriding” gives polymorphism. In this post, let’s see how a “generic method” can replace a number of overloaded methods. Then see under the hood as to what happens to the compiled...

Java Generics in no time “? extends” & “? super” explained with a diagram

Generics in Java can be be a bit tricky to get your head around. Hope the explanation below enhances your understanding of generics. This complements 5 Java generics interview Q&As with examples.

Plain old List, List <Object>, and List<?>

The plain old List: is a heterogeneous mixture or a mixed bag that contains elements of all types,

Read more ›

800+ Java Interview Q&As

Java & Big Data Tutorials