摘要:
Perosn父类 1 package day1_26; 2 3 public class Person { 4 String name; 5 int age; 6 public void eat() { 7 System.out.println("人,吃东西"); 8 } 9 10 public v 阅读全文
摘要:
public void sort(Comparator<? super E> c) Parameters:c - the Comparator used to compare list elements. A null value indicates that the elements' natur 阅读全文
摘要:
编写泛型类比普通类要复杂。通常来说,泛型类一般用在集合类中,例如ArrayList<T>,我们很少需要编写泛型类。 如果我们确实需要编写一个泛型类,那么,应该如何编写它? 可以按照以下步骤来编写一个泛型类。 首先,按照某种类型,例如:String,来编写类: 1 public class Pair 阅读全文