Is there a way to print a functional interface?

MazeOfEncryption :

Suppose I have an interface:

public interface Function {
    double function (double input);
}

Now, suppose I have created an instance of this interface somewhere in my main class,

Function f = (x) -> x;

How can I go about printing this function, in plain text? So, something a bit like this:

int f (double x) {return x}

Running a .toString on this Function prints something like Main$1@6d06d69c. How can I go about getting the java representation of this interface?

Code-Apprentice :

Remember that the text of a function (otherwise known as "code") only exists when you write it. You compile this to bytecode which is then run on the Java Virtual Machine. At runtime, the original code which you wrote no longer exists and cannot be easily retrieved.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=462060&siteId=1