Java (重要)super的使用姿势

package com.hotpot.main;

class Getc {
    String c;
    void value() {
        c = "yep";
    }
}
public class Main extends Getc {
    String c;
    void value() {
        c = "val1";
        super.value();
        System.out.println(c);
        System.out.println(super.c);
    }
    public static void main (String[] args) {
        Main m = new Main();
        m.value();
    }
}

猜你喜欢

转载自blog.csdn.net/YiLiXiaoHuiChen/article/details/82941421