java編程思想第四版第9章
阿新 • • 發佈:2017-05-03
art new end strac override @override err private over
練習3:
public class MainTest { public static void main(String args[]){ Bcycle b=new Bcycle(); b.print(); } /** * 輸出: * --Bcycle-------47 * ----print-----47 */ public static void p(String str){}; } abstract class Cycle{ public abstract void print(); } class Bcycle extends Cycle{ private int i=47; public Bcycle(){ System.out.println("--Bcycle-------"+i); } @Override public void print() { System.out.println("----print-----"+i); } }
java編程思想第四版第9章