This question is different from Getting the name of the current executing method.Because i want to get variable names not executing method name.
public static int addTwoNumbers(int a,int b){
int result=0;
result=a+b;
//system.out.println(error variable name);
return result;
}
In above code snippet addTwoNumbers
function add given two values and return the result.My requirement is something like this.Let say user accidentally pass different data type values (double and string).Then i want to output that caused variable name.so to do that i want to get current executing variable name.I would like to know that is it possible to get current executing variable name via java reflection or any other API.Please share your ideas.