jeudi 16 avril 2015

using getClass() relection method to output name of class

I am tring to get the class to print its own name using getClass(). i want it to include the package name too. the package is called "reflections" and the class is called ReflectionClass. This is what I have so far!



package reflections;
public class ReflectionClass {
public void className(){
String name = reflections.ReflectionClass.getClass().getName();
System.out.print(name);
}
}





Aucun commentaire:

Enregistrer un commentaire