newsuper.java

来自「这是一个关于J2EE的开源包common里的许多组件的示例应用程序,可以借鉴.」· Java 代码 · 共 89 行

JAVA
89
字号
/**
 * Title : Base Dict Class
 * Description : here Description is the function of class, here maybe multirows    
 * @author        kevin
 * @Version       1.0 
 */

package lang;

/**
 * Class description goes here.
 * @version 1.0  2005-12-13 
 * @author kevin
 */
class SuperEx
{
	protected int i = 100;
	String r;
	String s;

	public SuperEx()
	{
		System.out.println("系统无参");
	}

	public SuperEx(String a, String b)
	{
		r = a;
		s = b;
	}

	static void bMethod()
	{
		System.out.println("SuperEx.bMethod()");
	}
	public int getI()
	{
		return i;
	}
	
	public void aMethod()
	{
		System.out.println("r :" + r);
	}
}

public class NewSuper extends SuperEx
{
	protected int i = 10;

	public int getI()
	{
		return i;
	}

	public NewSuper(String a, String b)
	{
		super(a, b);
	}

	static void bMethod()
	{
		System.out.println("NewSuper.bMethod()");
	}

	public static void main(String args[])
	{
		SuperEx a = new SuperEx("Hi", "Tom");
		SuperEx b = new NewSuper("Hi", "Bart");
		a.aMethod();
		b.aMethod();
		SuperEx c = (SuperEx)b;
		c.aMethod();
		System.out.println("a==" + a.i);
		System.out.println("b==" + b.i);
		System.out.println("a.getI==" + a.getI());
		System.out.println("b.getI==" + b.getI());
		
		//SuperEx.bMethod();
		//NewSuper.bMethod();
	}

	public void aMethod()
	{
		System.out.println("r :" + r + "  s:" + s);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?