Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Tim Cooke
Ron McLeod
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
Devaka Cooray
Junilu Lacar
Saloon Keepers:
Tim Holloway
Carey Brown
Stephan van Hulst
Peter Rooke
Mikalai Zaikin
Bartenders:
Himai Minh
Forum:
Programmer Certification (OCPJP)
K & B: Inner Classes Self-Test
Venkat Sidh
Ranch Hand
Posts: 61
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I'm puzzled over the following question (Pg 659, Qn#3),
Given: public interface Runnable { void run(); } Which construct an anonymous inner class instance? (Choose all that apply.) A. Runnable r = new Runnable() { }; B. Runnable r = new Runnable(public void run() { }); C. Runnable r = new Runnable { public void run(){}}; D. Runnable r = new Runnable() {public void run{}}; E. System.out.println(new Runnable() {public void run() { }}); F. System.out.println(new Runnable(public void run() {}));
Answer is
E
but I thought it should be
D,E
since there's no difference b/w D and E except for
System.out.println
Any ideas?
[ October 27, 2006: Message edited by: Venkat Sidh ]
Keith Lynn
Ranch Hand
Posts: 2412
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Take a careful look again at the syntax in D.
Venkat Sidh
Ranch Hand
Posts: 61
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
got it
{}
instead of
{}
Thanks.
I am a man of mystery. Mostly because of this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
K&B Chapter 8: Inner Classes - Self Test
Anonymous Inner Class
Annonymous Inner Class
Inner Class
Inner Classes Mock question doubt
More...