多态
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); } }
原文地址:https://www.cnblogs.com/qingyundian/p/8435826.html
时间: 2024-10-09 16:58:53