+ 2

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?

7th Oct 2019, 10:53 AM
Lighton
Lighton - avatar
4 Answers
+ 1
Lighton KeyListener is a interfare itself. Check that link which is shared by us.
7th Oct 2019, 12:21 PM
A͢J
A͢J - avatar
0
Maybe this can help. Here given with examples. https://www.javatpoint.com/java-keylistener
7th Oct 2019, 11:24 AM
A͢J
A͢J - avatar
0
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
7th Oct 2019, 11:51 AM
Lighton
Lighton - avatar
0
I had exactly the same question for a while. 😆 https://www.sololearn.com/Discuss/1794604/?ref=app I hope this helps you.
8th Oct 2019, 7:36 AM
Stefanoo
Stefanoo - avatar