Get child class name from parent

On some occasions simply this line in the parent class solves this problem. It returns the name of the “child” class (not the parent):

this.getClass().getName() //String like "com.mycompany.myclassname"
this.getClass().getSimpleName() //String like "myclassname"

See here for further discussion: http://www.coderanch.com/t/324715/java/java/Getting-child-class-name-parent

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)