java - Can I override toString method of functional interface in JDK8 using lambdas -


can override tostring method of functional interface? or rephrase. there elegant way change anonymous inner class implements functional interface , overrides tostring method lambdas? can override tostring when create lamba expression in jdk8.

interface iface {     void do(); }  main() {      iface iface = () -> /*do something*/     system.out.println(iface); // see useful in output } 

can override tostring iface?

no, lambda expressions used express 1 method interfaces if functions. it's element of functional languages implemented in java (an oop language).

to override tostring, must implement interface in class.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -