The Run-Time Types of Generic Type Instances : Generic Class « Generics « Java Tutorial






import java.util.LinkedList;

public class MainClass {
  public static void main(String[] args) {

    LinkedList<String> proverbs = new LinkedList<String>();
    LinkedList<Double> numbers = new LinkedList<Double>();
    System.out.println("numbers class name " + numbers.getClass().getName());
    System.out.println("proverbs class name " + proverbs.getClass().getName());
    System.out.println("Compare Class objects: " + numbers.getClass().equals(proverbs.getClass()));

  }
}
numbers class name java.util.LinkedList
proverbs class name java.util.LinkedList
Compare Class objects: true








12.6.Generic Class
12.6.1.Defining a Generic Class Type
12.6.2.Using Primitive Type Wrapper Class Types as Arguments
12.6.3.The Run-Time Types of Generic Type Instances
12.6.4.Generic class Stack
12.6.5.Use generic method to test generic Stack
12.6.6.Raw type test for a generic Stack