public class Box <T> { private T data; public Box(T data) { this.data = data; } public T getData() { return this.data; } } Box box = new Box<>("My String"); // Raw type box String s2 = (String) box.getData(); // No incompatible type error String s1 = box.getData(); // Incompatible type error