首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

向上转型,向下转型

整理日期:2007年08月12日 【字体:

要给学生们讲卷子,不知道这个转型问题怎么讲,搜了几个例子,才发现这个例子最合适,也好懂。

class  Chinese{

     public  static  void  print(){
         System.out.println("this  is  中国人");

     }

 }
 class  Guangdongren  extends  Chinese{
     public  static  void  print(){
         System.out.println("this  is  广东人  ");
     }

 }
 class  HunanRen  extends  Chinese{
     public  static  void  print(){
         System.out.println("this  is  湖南人  ");
     }

伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-08/1186901451.html
 }
Tags:
向上转型,向下转型
'http://www.etoow.com/html/2007-08/1186901451.html
1
 
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved