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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
Reg. Runnable
Angela Narain
Ranch Hand
Posts: 327
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Another example from Barry Boone's exam :
class Dots implements Runnable { DotThread t; public static void main(String[] args) { Dots d = new Dots(); d.t = new DotThread(); } public void init() { t.start(); t = new DashThread().start(); } } class DotThread extends Thread { public void run() { for (int index = 0; index < 100; index++) System.out.print("."); } } class DashThread extends Thread { public void run() { for (int index = 0; index < 100; index++) System.out.print("-"); } } 1.nothing 2.100 dots (.) 3.200 dots (.) 4.100 dashes (-) 5.100 dots (.) and 100 dashes(-)
The correct answer is 1
But it should get compile time error as Dots implements
Runnable but does not provide the run() method.
james hoskins
Ranch Hand
Posts: 31
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hello angela,
you are right, no run() method means Dots must be declared abstract.
kind regards,
james
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Is there any mistake in this Thread code.
reg a mock exam
Confused with mock exam question
Boonie's Exam: 47 - mistake??
Boone's mock exam Q47
More...