Let’s begin with a simple example for this installment.讓我們開始與一個簡單的例子,這個分期付款。

 import java.util.Collection; public class TestType {   public static進口java.util.collection ;公共類testtype (公共靜態  Collection myMethod(Collection a) {     return a;   }   public static void main(String … args) {     System.out.println(myMethod("Hello World"));   } }收集mymethod (收集一) (返回; )公共靜態無效的主要(字符串… args ) ( system.out.println ( mymethod ( “世界您好” ) ) ; ) ) 

Note:注意:
1. 1 。 The import statement is obviously not required. 進口的聲明,顯然是不是必需的。 It has been added for effect.它已添加的效果。
2. 2 。 Yes, this code compiles and runs.不錯,這代碼編譯和運行。

What we can learn from this simple example:我們可以了解從這個簡單的例子:
1. 1 。 Yes, you can use any valid identifier as a type name; no need to stick to bland Sun prescribed T, K & V是的,您可以使用任何有效的標識符作為一個類型名稱;沒有必要堅持平淡孫明噸,鉀及V

2. 2 。 DO NOT use an existing class name as type identifier.不使用現有的類名稱作為類型標識符。 It can seriously obfuscate your code.它可以嚴重混淆您的代碼。