2010/9/23 chairuou <chair...@gmail.com>: > Cái pointer từ Bug sang chém gió thì khai báo biến kiểu gì hả các cụ? Nhất > là cụ gì bên eXO giả nhời cháu phát, cháu nghe đồn bên ấy gió thổi vù vù > quanh năm, mát vô cùng ạ.
Java khong co khai niem pointer. 8<-- 8<-- 8<-- import java.util.Random; class Fanboy { public Fanboy(String fType) { type = new String(fType); } public String toString() { return type; } public void sendToList(){ System.out.println("LOL"); } private String type; } class ChemGioFanboy extends Fanboy { public ChemGioFanboy(String fType){ super(fType); } public void sendToList() { System.out.println("Đây là một lỗ hỏng hết sức nghiêm trọng và rất ngớ ngẫn của Microsoft."); } } class BugFanboy extends Fanboy { public BugFanboy(String fName) { super(fName); } public void sendToList() { System.out.println("http://www.youtube.com/user/cryptbe#p/a/u/0/yghiC_U2RaM"); } } public class FanboySoRandomLOL { public static void main(String[] args) { Fanboy[] myBoys = { new ChemGioFanboy("ChemGio1"), new BugFanboy("Bug1"), new ChemGioFanboy("ChemGio2"), new BugFanboy("Bug2"), new ChemGioFanboy("ChemGio3") }; Fanboy currentBoy; Random select = new Random(); for (int i = 0; i < 50; i++) { currentBoy = myBoys[select.nextInt(myBoys.length)]; System.out.println("\nNguoi se post tiep theo: " + currentBoy); currentBoy.sendToList(); } } } 8<-- 8<-- 8<-- -- Sent from my Lunix. _______________________________________________ POST RULES : http://wiki.hanoilug.org/hanoilug:mailing_list_guidelines _______________________________________________ HanoiLUG mailing lists: http://lists.hanoilug.org/ HanoiLUG wiki: http://wiki.hanoilug.org/ HanoiLUG blog: http://blog.hanoilug.org/