List x = new LinkedList();
Of course, you can also decide to make x a LinkedList (instead of a generic List)and carry the precise type information around with x. The beauty (and the intent) of using the interface is that if you decide you want to change your implementation, all you need to do is change it at the point of creation, like this:
List x = new ArrayList();
The rest of your code can remain untouched (some of this genericity can also be achieved with iterators).
鎿嶃€備互鍓嶆€庝箞灝辨病浜鴻繖涔堣榪囧憿銆傚鐨勶紝閮芥槸鍨冨溇錛?/p>