Javaコード出力が「father」か「child」か(一)


1、例
/**
 *           
 */
package com.you.model;

/**
 * @author YouHaidong
 *      
 */
public class FatherChild {

	/**
	 * @param args
	 */
	@SuppressWarnings("static-access")
	public static void main(String[] args) 
	{
		Father father = new Father();
		Father child = new Child();
		System.out.println(father.getName());
		System.out.println(child.getName());
	}
}

/**
 * 
 * @author Administrator
 *   
 */
class Father
{
	public static String getName()
	{
		return "father";
	}
}

/**
 * 
 * @author Administrator
 *   
 */
class Child extends Father
{
	public static String getName()
	{
		return "child";
	}
}

2、出力結果
father father