S
Sean Kim
public abstract class Armor
{
// 1st way but not working
public static String getType()
{
return this.class.getSimpleName();
}
}
public class BackArmor extends Armor
{
// 2nd way
// I can do this but.. I wanna do 1st way
// public static String getType()
// {
// return BackArmor.class.getSimpleName();
// }
}
-------------------------
// I want to do like this
BackArmor.getType();
but 'this' is not working inside static method.
Is there any way I can get name of class in static method?
Thank you
Sean
{
// 1st way but not working
public static String getType()
{
return this.class.getSimpleName();
}
}
public class BackArmor extends Armor
{
// 2nd way
// I can do this but.. I wanna do 1st way
// public static String getType()
// {
// return BackArmor.class.getSimpleName();
// }
}
-------------------------
// I want to do like this
BackArmor.getType();
but 'this' is not working inside static method.
Is there any way I can get name of class in static method?
Thank you
Sean