java anonymous class
i dont get what are anonymouss classes i dont get why interface method can be called whats wrong
20 Replies
⌛
This post has been reserved for your question.
Hey @eat1.! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
i dont get
how interface methods can be called
what is one use classes also

here interfce method is called
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Like this
i am too confused lets say i have created interface Sound with methods void saySomething(); and i have Main class is it possible to create interface object ?
like Sound animal = new Sound()
sound is interface
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
then here why i can create interface object
then call method
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
so anonymous classes are used to call interface methods
is not it
?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
aaaah
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
so anonymous classes are used to implement interfaces right ?
Can also extend classes, but implementing interfaces is one way to use anonymous classes, yes
thanks guys
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@401165145327271976>.