java基础 静态 static 问在多态中,子类静态方法覆盖父类静态方法时,父类引用调用的是哪个方法?
多态
package com.swift.jiekou; public class Jicheng_Tuotai_jingtai_diaoyong { public static void main(String[] args) { Fu f=new Zi(); f.show(); } } class Fu{ static int x=1; public static void show() { System.out.println("父类的方法"+x); } } class Zi extends Fu{ static int x=2; public static void show() { System.out.println("子类的方法"+x); } }
Never waste time any more, Never old man be a yong man