How execute content of a String

have an instruction at String, how can execute?example String ah="System.out.println(\"Hello world\");";
[125 byte] By [yoshi_01a] at [2007-10-3 2:01:45]
# 1
What are you trying to do? Odds are there's a better way to do what you need.
SoulTech2012a at 2007-7-14 19:00:29 > top of Java-index,Desktop,Developing for the Desktop...
# 2
use thisRuntime.getRuntime().exec("notepad");
yashyash1234a at 2007-7-14 19:00:29 > top of Java-index,Desktop,Developing for the Desktop...
# 3
> use this> Runtime.getRuntime().exec("notepad");i don't think that's what he/she is asking. what he/she wants to do is execute a line of code, not run a program.
SoulTech2012a at 2007-7-14 19:00:29 > top of Java-index,Desktop,Developing for the Desktop...
# 4

Hmm...

I'm not too sure whether I fully understood what you are asking but I'll try answering.

You would like to know how your program would execute the string "System.out.println(\"Hello world\");";...

Well maybe you could assign "Hello World" to the String ah rather than , "System.out.println(\"Hello world\")";

Then depending on the users choice (I'm assuming that your program will be dependent on user input (?)) i.e. if they clicked 1 this would indicate the instruction of printing the string ah to screen.

Don't know much about your program - so have made assumptions. If you want clearer, detailed help/advice you need to post further details as the other posters have mentioned!

elijaha at 2007-7-14 19:00:29 > top of Java-index,Desktop,Developing for the Desktop...