This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

anonymous inner class and enum contants  RSS feed

 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was thinking that can an enum contant declare a new method in its anonymous block which wasnt already there in the enum?

and does an anoymous class declare a new method that wasnt there in the superclass....

i think we can declare new methods but we can call them...am i right? just checking if my concept was right
 
Ankit Garg
Sheriff
Posts: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raju Champaklal wrote:i think we can declare new methods but we can call them...am i right?

We can declare then but we cannot call them. The easiest way to find out is generally to try such a thing, and then you can confirm here...
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh yes....actually that was a can't and not a can....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!