Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Boone's mock exam Q47 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Boone Watch "Boone New topic

Boone's mock exam Q47

Chun Wang
Ranch Hand

Joined: Jan 24, 2001
Posts: 42
Here is a queston from Barry Boone's exam Q47.
the code below will NOT compile because Dots class didn't implement the void run() from Runnable. so Dots must be an abstract class. and answer a says prints nothing. I think it should say won't compile. any comments ?
class Dots implements Runnable {
DotThread t;
public static void main(String[] args) {
Dots d = new Dots();
d.t = new DotThread();
public void init() {
t = new DashThread().start();

class DotThread extends Thread {
public void run() {
for (int index = 0; index < 100; index++)
class DashThread extends Thread {
public void run() {
for (int index = 0; index < 100; index++)

b.100 dots (.)
c.200 dots (.)
d.100 dashes (-)
e.100 dots (.) and 100 dashes(-)
Amit, Jhalani

Joined: Jan 11, 2001
Posts: 21
I also think it should say won't compile.
Ishaan Mohan
Ranch Hand

Joined: Jan 20, 2001
Posts: 115
Yes it will not compile as Dots class does not define run() in it.
I agree. Here's the link:
subject: Boone's mock exam Q47
It's not a secret anymore!