0

Interfaces

Why should I create interfaces in java? Can I describe functions of interface in one class and then use them just by implementing the Interface and call them or I should describe function in every class I implementing the Interface? As i know KeyListener is an Interface. How can I make something similar to KeyListener with interfaces functions that are called automatically?

9th Aug 2019, 5:02 PM
Lighton
Lighton - avatar
2 odpowiedzi
+ 1
Like KeyListener I mean to be called automatically when something happens. For example when something is moved then check for collision or something like that!
9th Aug 2019, 6:09 PM
Lighton
Lighton - avatar
+ 1
This question requests lines in order, but the main class calls lines in wrong order. Is this intentional (so we find the error to pass) or is there something I'm missing to make the lines come out in right order without changing the main class?
17th May 2021, 2:38 AM
James McKee Jr
James McKee Jr - avatar