zoukankan      html  css  js  c++  java
  • 子类父类构造函数

    class Base {

    private String name = "base";

    public Base() {
    tellName();
    printName();
    }

    public void tellName() {
    System.out.println("Base tell name: " + name);
    }

    public void printName() {
    System.out.println("Base print name: " + name);
    }
    }


    public class Dervied extends Base {

    private String name = "dervied";

    public Dervied() {
    tellName();
    printName();
    }

    public void tellName() {
    System.out.println("Dervied tell name: " + name);
    }

    public void printName() {
    System.out.println("Dervied print name: " + name);
    }

    public static void main(String[] args){

    new Dervied();
    }
    }
    -----------------------------------------------

    Dervied tell name: null
    Dervied print name: null
    Dervied tell name: dervied
    Dervied print name: dervied



  • 相关阅读:
    总结
    kafka
    kafka前传 JMS
    currentHashMap
    mapPartitionsWithIndex foreachPartitionAsync foreachPartition
    hbase
    hive
    zookeeper kafka storm
    flume的简单使用
    spring-data-jpa
  • 原文地址:https://www.cnblogs.com/2016-cxp/p/11005287.html
Copyright © 2011-2022 走看看