This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates 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.