In the first example, you have a generic class with type T, which needs to be defined (exact type hiding behind the T) by creating a new Test class object.
At the same moment, the same type T is used for static method, which can be executed without creating a Test class object which cannot be made.
The second example runs, because you declare the <T> type within the static method - not on class level, so it's fine.
It is also related to the URL passed above. You can define a reference type to an array of concrete parametrized type, but you cannot instantiate this array.
By saying this:
You are defining your own parametrized type named String (by convention, normally these are named like T or E). There is nothing preventing you from naming the generic type as the class name that already exist. Remember it has nothing with the extension of the class - it is just shadowing.
Therefore, the "my" reference variable is not a java.lang.String reference type, but your own String type reference, which cannot be assigned to String literal ("Hello!").
OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
Good to point out such depth things but in OCJP real exam it will not be such depth. If you take online training or if you read the books like K&B you will come to know at what level the questions are being asked in the exam.