I'm a C/C++ programmer and am now trying to migrate into Java. I'd appreciate any help here!
How do I use the value (or the name) of a string to initialize a variable in java?
I've done the following:
String str1 = "t"; //want to create objects "final Text" for(int i = 0; i==80; i++) { //Concatenate the value of i into str1 str1 += i; final Text str1 = new Text(s, SWT.SINGLE | SWT.BORDER); str1 = "t"; }
That "final Text str1" is causing me all kinds of headaches. I was trying *str1, &str1, trying to access the value by using str1.ToString(), etc..
I'd like to name my object Text as t1, t2, t3, t4, etc..
That second declaration was meant to use the value of str1 to initialize my object Text. I wasn't trying to declare the same name twice. I just put str1 in that spot to demonstrate.
Any thoughts on how I can get the value as the name of that Text object?