• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






Quentin Yo

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2013年9月4日

java继承过程中方法覆盖问题——“=”左右两边分别为父类和子类类型
摘要: 1 package cn.tju.acculation.base; 2 3 public class Extend { 4 5 public static void main(String args[]) { 6 //在方法覆盖中,左右俩边分别为父类和子类的时候,以左边作为调用的入口,右边作为调用的实际调用执行的方法。 7 P t2= new T(); 8 //t2是Parent的对象,t2调用的方法只能是Parent的方法,但是实际调用是调用子类还是父类的方法,是看new谁,new谁就调用谁 9 //只有子类的对象... 阅读全文
posted @ 2013-09-04 22:05 QuentinYo 阅读(508) 评论(0) 推荐(0)
 
java中的this和super关键字
摘要: 1 package cn. tju. acculation. keywords; 2 3 4 public class ThisAndSuper { 5 6 public static void main( String[] args ) { 7 Student s1 = new Student( "zhangsan" , 14) ; 8 s1 .print (); 9 10 Student s2 = new Student( "lisi" , 12, "23" );11 ... 阅读全文
posted @ 2013-09-04 21:37 QuentinYo 阅读(248) 评论(0) 推荐(0)