#Doubt related Interface implementation
23 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
no
if u want a class that can say "im an instance of this interface" then it must have implemented all abstract methods
ohh
u cant say "ICanJump" and then only implement one of the two methods ICanJump demands
Which means you can't use a lambda or method reference, since those only apply to 'functional interfaces' that have a singl abstract method.
yeah
But you can implement both with an anonymous inner class.
hmm
It's just not nearly as syntactically convenient.
yeah I'd rather make a class that implements the interface and then make an instance of that class
Yeap.
also when you said functional interfaces have a single abstract method , does it mean that the interface cannot have defined or concrete methods as well?
its about abstract methods
No. I meant that you can ignore the non-abstract methods... you can have as many of them as you like (well, up to the bytecode format limit)