练习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); } }