We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I hope this question isn't too obvious or anything. Whenever I try to create an interface, like below, I always get an error that says:
interface TheInterface {
void move();
}
The member TheInterface can only be defined inside a top-level class or static context.
What am I doing wrong?
Thanks!
Answers
Either use
or my preference would be to create a new tab called
TheInterface.java
and put the interface code in thatTheInterface.java
tabBTW I think the first version (
static
) would work but I only ever create interfaces in their own tab so I haven't tested it.https://Forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
static
members defined in their body. [-Xfinal
compile-known constant fields. :-$static
. ~O)interface
member outside its current innerclass
. *-:)class
asstatic
, so it can havestatic
members. :ar!Thank you for the responses! Creating it in a new tab did the trick :) Have a good one <3
interface
outside its innerclass
. :-\"@GoToLoop - always good input, thanks. One follow-up question: how do we define an interface outside of an inner class? Right now I have an interface in its own tab, and according to my understanding by default this means it is already in an inner class. Thanks in advance - Andy