java的静态方法跟非静态方法

java的静态方法和非静态方法public class Test{public static void main(String[] args){M m new N()Sy

java的静态方法和非静态方法
public class Test  
{  
    public static void main(String[] args)  
    {  
        M m = new N();  
          
        System.out.println(m.getName());  
          
        System.out.println(m.getValue());  
          
        if(m instanceof N)  
        {  
            System.out.println("1");  
        }  
          
        if(m instanceof M)  
        {  
            System.out.println("2");  
        }  
    }  
}  
 
class M  
{  
    public static String getName()  
    {  
        return "M";  
    }  
      
    public String getValue()  
    {  
        return "MM";  
    }  
}  
 
class N extends M  
{  
    public static String getName()  
    {  
        return "N";  
    }  
      
    public String getValue()  
    {  
        return "NN";  
    }