10/14/2011 8:18:51 PM
Viewed: 1947
teanjava
9/20/2011 2:47:09 AM
Core Java - Abstract Example
Tạo class Abstractdemo

/* @author Nguyen Ngoc Truong */
abstract class Abstractdemo {

    abstract void show();

    abstract void display();

    void show1() {
        System.out.println("Concreate Method");
    }
}


Tạo class AbstractExt
/* @author Nguyen Ngoc Truong */
class AbstractExt extends Abstractdemo {

    void show() {
        System.out.println("Hi");
    }

    void display() {
        System.out.println("Hello");
    }
}

Tạo class AbstractMain để chạy thử

/* @author Nguyen Ngoc Truong */
public class AbstractMain {

    public static void main(String[] args) {
        AbstractExt demo = new AbstractExt();
        demo.show();
        demo.show1();
        demo.display();
    }
}
Having Tea And Feeling Java

Gửi trả lời