This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
how can i still get the Class name in static method from none static variable ?
There is no way to access non static varible in static method.
In this case If you want to access String s inside public static void getName() method, make s variable static constant public static final String s = getClass().getSimpleName(); . Because in anyways class name is not going to change.