I assume, that you want to create a String
object with some Java statements and execute the content as if it was a method.
No, it is not possible, because that would imply, that java was an interpreted programming language. Which is not the case.
You could merge the line with some sort of class template (on another string), store it to a file, compile that using the jdk (call javac with `Runtime.exec) and load the class with a custom classloader, then reflect the method and hope for the best.
There is a rather complicated way using the fairly new Java Compiler API, but I guess, that is far beyond your needs. (And there have to be some more complicated tricks, because the eclipse IDE provides views that allow executing Java statements.)
solved How to make a string in to code [duplicate]