parent children

class parent{
                   protected static int count=0;
            public parent()          {   count++;    }
}
public class child extends parent{ public child() { count+=5; } public static void main(String args[]){ child x=new child(); System.out.println("count="+x.count); } }

posted @ 2014-09-14 15:41  fantasy12436109  阅读(306)  评论(0编辑  收藏  举报