Bookmark Topic Watch Topic
  • New Topic

Eval in Java?

 
Matt Ghiold
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hey guys,
Does anyone know a way to do the following in java?
int count_5 = 12;
String test = 5;
count_$test would = 12 in korn shell.
Is there a way to do this in Java?
Please help.
Thanks,
 
Sri Addanki
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hey Matt,
I don't know the solution, but trying to understand your question.
Can you please elaborate?
thanks,
sri
 
Matt Ghiold
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Report post to moderator
Not a problem. Basically what I want to do is to be able to dynimically identify the variable count_5. I want to accomplish this by using a fixed count_ and apply a variable to that test in this case to identify the int count_5
So, something like this...
int count_5 = 12;
String test = 5
Now, I want to get 12, but the only way I know that is by using the variable test, such that
String count = "count_"
int x = count_ + test This should equal the count_5 varible and return a 12.
How this makes a little more sense.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Report post to moderator
Is this question in the correct thread?
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Matt, I am not sure which forum this actually belongs in. However, it isn't for the SCJD assignment, so I have to close this thread. Please chose another forum to post this question that will better match your question.
Thanks
Mark
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!