troubleshooting Question

Executing string as a statement

Avatar of dkim18
dkim18 asked on
JavaJava EE
9 Comments3 Solutions209 ViewsLast Modified:
Hi Experts,

This might be a stupid question, but I will ask anyway. If I store numerous java statements as string in…string array for example, is there any way that I can execute them?

For example, if I have the following:

String [] TEST = {“this.getNum1()”, “this,getNum2()”, …};

Is there any way that I can execute TEST[0] and TEST[1], so I can use result of executing this.getNum1() and this.getNum2()?

thanks,
ASKER CERTIFIED SOLUTION
Kannan Ekanath

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros