In Matlab, whenever I enter a variable name into command window, it displays the value of that variable so far, very useful feature. So that, I tried to add the same feature in java. That is, I want to display the value of any kind of variable(int, double, value of array such as signal[4] ) when the user enters something. If entered variable does not exist, it gives error or blows up. More precisely, I want to add something similar to the code below at the end of my project.
while(true){
Scanner scan = new Scanner(System.in);
System.out.println("Yep? : ");
String s = scan.nextLine();
System.out.println(s + " = value of that entered variable");
}
Obviously, It is not as easy as it sounds but that is the reason I am asking in here. Is there any easy way to add this simplicity?