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
Post a Comment