What is the difference between the two :
ArrayList<String> linkList = new ArrayList<String>();
ArrayList linkList = new ArrayList<String>();
Or is there any difference ?
uses generics to ensure type safety.
doesn't. As @BruceMartin points out, this means that the lines
gives a compile time error in the first case, but fails at runtime with the second declaration.
As another example, to
At compile time: the first one uses generics, ensures type safety and code readability.
At runtime: they are the same.
Also in the first case linkList is of type String and in the second case is of type Object.