This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Anonymous class

 
Saibabaa Pragada
Ranch Hand
Posts: 162
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, This is from ExamLab. Please advice why I am getting this error at Line 9.
 
swaraj gupta
Ranch Hand
Posts: 182
C++ Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saibabaa Pragada wrote:Hi, This is from ExamLab. Please advice why I am getting this error at Line 9.


rb is Runnable(Supertype) type reference-variable and is referring to an instance of its anonymous subclass(Subtype), so using that reference it is not possible to invoke a method that does not exist in Runnable<interface>.

Note: When super class reference-variable is referring subclass instance then through that reference only those methods can be invoked that exists in both superclass and the subclass.
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please check the API for Runnable to see if it has start() method defined for it? You always use a Thread instance to start the thread.
 
Imad Aydarooos
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to pass the Runnable type object to a Thread object, after that you have to invoke start() on the Thread object
 
Mark Guo
Ranch Hand
Posts: 58
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This is the correct way to invoke start();

Regards!


 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic