总结:多态。重写。构造方法调用

package com.a;

public class fsd {

	int a = 23;

	public fsd() {
System.out.println(44444444);
} public void txt(int a) {
System.out.println(a);
} } class yan extends fsd {
int b = 54; public yan() {
System.out.println(7);
} public void txt(int b) {
System.out.println(b);
}
} package com.a; public class Test {
public static void main(String[] args) {
// fsd s=new fsd();//调用父类无参数构造方法
// s.txt(2);//调用 子类的普通方法,方法重写,父类方法将被隐藏
fsd d = new yan();// 多态把所有不带参的构造方法调用了。父类和子类的。重写的只调用子类方法,父类方法将被覆盖
d.txt(21); } } 44444444
7
21

  

最新文章

  1. 自连接<EntityFramework6.0>
  2. angularJs之内置服务
  3. N久没写过东西了..写个最近在研究的程序
  4. oracle 职业学习指引
  5. hibernate查询方式
  6. CSS设置技巧
  7. (《数论及应用1.3》NEFU 116 两仪剑法(最小公倍数&&最大公约数))
  8. Gulp使用指南
  9. [leetcode] Combination Sum and Combination SumII
  10. vue.js 组件之间传递数据
  11. c++ 之模板进阶
  12. idea使用记录
  13. 欣赏<沉默的大多数>——王小波
  14. unity的一些tips
  15. c++命名空间---namespace
  16. mysql关联更新update
  17. vue总结 03过滤器
  18. angularjs获取元素以及angular.element()用法
  19. 虚拟IP和IP漂移
  20. C++实现:把一个文件夹里的冗余文件(.txt)删除

热门文章

  1. Windows10在待机状态时会卡屏的解决方案
  2. 高通LCD驱动调试
  3. Java public class 与 class 区别
  4. centos7下安装jdk7
  5. read_excel
  6. 深入分析理解Tomcat体系结构
  7. Spring Boot入门——tomcat配置
  8. java:jsp: 一个简单的自定义标签 tld
  9. 2017-03-05 CentOS中结合Nginx部署dotnet core Web应用程序
  10. SQL Server循环插入数据