ҧ Generic ( array Ѻ)
:: ¹ҡѹ :: Java 2 v 5.0 (Tiger) :: Generics
หน้า 1 จาก 1
ҧ Generic ( array Ѻ)
package gen;
public class stats {
public static void main(String[] args) {
Gen test = new Gen(100);
// Gen [] arr = new Gen[100];
// Compile Error Can't Array
System.out.println(" Show "+test.getob());
}
}
//A simple generic class in Java v. 5.0
class Gen {
T ob; // declare an object of type T
// class Constructor
Gen(T o) { ob = o; }
// the Get method
T getob() { return ob; }
}
public class stats {
public static void main(String[] args) {
Gen test = new Gen(100);
// Gen [] arr = new Gen[100];
// Compile Error Can't Array
System.out.println(" Show "+test.getob());
}
}
//A simple generic class in Java v. 5.0
class Gen {
T ob; // declare an object of type T
// class Constructor
Gen(T o) { ob = o; }
// the Get method
T getob() { return ob; }
}
Similar topics
» ??????????ͧ??????ǡѺ Generic ???
» ??????ҧ????? Enum
» ??????ҧ Start ??? Run ??ҧ?ѹ?ѧ???
» A simple generic class in Java v. 5.0
» ??????ҧ??????ҧ GUI ???? Swing
» ??????ҧ????? Enum
» ??????ҧ Start ??? Run ??ҧ?ѹ?ѧ???
» A simple generic class in Java v. 5.0
» ??????ҧ??????ҧ GUI ???? Swing
:: ¹ҡѹ :: Java 2 v 5.0 (Tiger) :: Generics
หน้า 1 จาก 1
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ