Interfaces in java(KeyListener) | Sololearn: Learn to code for FREE!


Interfaces in java(KeyListener)

Hey, I made a research about interfaces and I found that you can declare functions in them without body and their functionality you need to write in class in which you implement this interface! So how the KeyListener does something on click or on release the key etc. How can I create an Interface to be able to call update funcion only after some event?

10/7/2019 10:53:47 AM


4 Answers

New Answer


Lighton KeyListener is a interfare itself. Check that link which is shared by us.


Maybe this can help. Here given with examples.


No I mean this thing: KeyListener has some funcionality! Interfaces cannot have funcionality! How this stuff works? How to create an Interface that will do some operations for example update on some event such as player moved


I had exactly the same question for a while. 😆 I hope this helps you.