第1个回答 2015-07-07
package com.prj.test;
public class Parent {
public static void main(String[] args) {
new Parent().printMethodName();
}
public void printMethodName(){
System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
}
public void printClassName(){
System.out.println(this.getClass().getName());
}
}
class Son extends Parent{
@Override
public void printClassName() {
// TODO Auto-generated method stub
super.printClassName();
}
@Override
public void printMethodName() {
// TODO Auto-generated method stub
super.printMethodName();
}
}