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
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
Programmer Certification (OCPJP)
K & B: Inner Classes Self-Test
Venkat Sidh
Ranch Hand
Posts: 61
posted 17 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 17 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 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
got it
{}
instead of
{}
Thanks.
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
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...