The simple answer is that you can't / shouldn't try to do that kind of stuff in Java. Java variable names must be known at compile time. Period.
And in this particular case, it seems like it would be a pointless exercise anyway. Consider this:
String buildstring_<buildNumber> = ...
How are you going to use this hypothetical variable?
if (buildstring_<buildNumber>.equals(...)) {
....
}
But you could have achieved the same thing like this:
String buildstring_current = ...
if (buildstring_current.equals(...)) {
....
}
OK, so suppose there are lots of these build strings ...
String buildstring_1 = ...
String buildstring_2 = ...
String buildstring_3 = ...
if (buildstring_<buildNumber>.equals(...)) {
....
}
Fine ... but what happens when <buildNumber>
is one greater than the last buildstring_?
declaration? Compilation error or runtime error!!!
No. The sensible way to do this in Java is to use an array or a Map
... or possibly something read from a properties file.