I'm trying to check if a variable exists in a class. For this I am using the code:
try{
clazz.getDeclaredField("id");
} catch(Exception e){
System.out.println(e.getMessage());
}
With this I can see without problems.
My Problem: When the variable does not exist, java prints the name of the variable that does not exist in the console, I need this information not to appear if the variable does not exist. How do I not do this? Can anybody give me a light?
EDIT: even removing System.out.println (e.getMessage ()); it continues to print the name of the variable that does not exist, this is what I do not want to appear