Would you like to react to this message? Create an account in a few clicks or log in to continue.

ҧ Generic ( array Ѻ)

Go down

ҧ Generic ( array Ѻ) Empty ҧ Generic ( array Ѻ)

ตั้งหัวข้อ  Admin Thu May 22, 2008 2:34 am

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; }

}
Admin
Admin
Admin

จำนวนข้อความ : 112
Registration date : 18/05/2008

http://chawban.chocoforum.com

ขึ้นไปข้างบน Go down

ขึ้นไปข้างบน

- Similar topics

 
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ