• Post Reply Bookmark Topic Watch Topic
  • New Topic

Kathy Sierra Book for SCJP 1.5 page 682-Clarification

 
T Sathya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In the SCJP 1.5 Kathy Sierra Book (Page 682, Chapter 9, Threads) , I find in the exam watch box, the following



which is kind of misleading as it is shown that Interface is being instantiated using a new keyword.

Is nt it? May be somewhere am i wrong?

I would appreciate if anybody can clarify the above if am i wrong or it is really given wrongly.

Thanks,
Sat
 
Jan Van den bosch
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right. I'm not familiar with the book but the Runnable object definitely needs to implement the run() method:

 
Vijitha Kumara
Bartender
Posts: 3952
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's called anonymous inner class, where you can implement an interface/extend a class without explicitly declaring a class .
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the code is definitely incorrect. In fact, it's already mentioned in the K&B errata.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!