我正在寻找一种解决方案,它将为我提供密码变量值传递的每个变量的名称。即,{pass, temp, temp1, var1}
class Student{
public static void main(String args[]){
String password="GOPAL12345";
Student student=new Student();
String var1=student.passPassword(password);
System.out.println("Password is--> "+var1);
}
public String passPassword(String pass){
String temp=pass;
String temp1=temp;
return temp1;
}
}
我希望这在运行时完成。
最佳答案
这是不可能的。变量名称 {pass, temp, temp1, var} 在运行时不存在。
关于java - 如何识别指令中的变量名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16578431/