0
点赞
收藏
分享

微信扫一扫

super("111");//手动调用

自信的姐姐 2023-06-16 阅读 20


class Base 
{
	public Base()
	{
		System.out.println("Base()!");
	}

	public Base(String str)
	{
		System.out.println("Base!"+str);
	}

	public static void main(String[] args) 
	{
		System.out.println("Hello World!");
	}
}

public class Derive extends Base 
{
	public Derive()
	{
		//super(); //默认调用这一个
		super("111");//手动调用这一个
		System.out.println("Derive()!");
		
		
	}

	public static void main(String[] args) 
	{
		System.out.println("Hello World!");
		Derive onj=new Derive();

	}
}
/*
Hello World!
Base!111
Derive()!
请按任意键继续. . .
*/



举报

相关推荐

0 条评论