P
Pete
Hi All,
Just revising for my SCJP exam and have a couple question I trust you
will be able to help please.
1)
below is a package structure for a set of classes
com -- foo ( 1st level dir)
bar ( 2nd level dir)
dog ( class )
blatz (3 level dir)
Book ( class )
-- bar (1st level dir)
Car (class)
blatz (2nd level dir)
Sun (class)
Insert 3 statement in the following code from choice below
<insert statement 1>
<insert statement 2>
<insert statement 3>
public class Car {
Book book;
Dog dog;
}
Choices
a) import com.foo.bar.blatz.*;
b) import com.bar.*;
c) package com.bar;
d) import com.foo.bar.*;
e) package com.foo.bar.blatz;
f) import com.*;
g) package com;
h) //blank
i) import com.foo.bar.Book;
The first statement has to be c).
However, the next could be either
1) import com.*;
//blank
//blank
or
2) import com.foo.bar.*;
//blank
//blank
or
3) import com.foo.bar.*;
import com.foo.bar.blatz.*;
//blank
But there is only one correct answer .... am I missing something
( probably ) .. can someone explain !!
2) My second question is to do with threads.
public class foo extends Thread implements Runnable {
public void run() { };
}
As both Thread & Runnable have run() as abstract, is it ok for Foo to
provide
definition of run as above ?
If correct, is the run assoicated with Thread abstract method of the
Runnable abstract method.
Thank all for you help.
Pete
Just revising for my SCJP exam and have a couple question I trust you
will be able to help please.
1)
below is a package structure for a set of classes
com -- foo ( 1st level dir)
bar ( 2nd level dir)
dog ( class )
blatz (3 level dir)
Book ( class )
-- bar (1st level dir)
Car (class)
blatz (2nd level dir)
Sun (class)
Insert 3 statement in the following code from choice below
<insert statement 1>
<insert statement 2>
<insert statement 3>
public class Car {
Book book;
Dog dog;
}
Choices
a) import com.foo.bar.blatz.*;
b) import com.bar.*;
c) package com.bar;
d) import com.foo.bar.*;
e) package com.foo.bar.blatz;
f) import com.*;
g) package com;
h) //blank
i) import com.foo.bar.Book;
The first statement has to be c).
However, the next could be either
1) import com.*;
//blank
//blank
or
2) import com.foo.bar.*;
//blank
//blank
or
3) import com.foo.bar.*;
import com.foo.bar.blatz.*;
//blank
But there is only one correct answer .... am I missing something
( probably ) .. can someone explain !!
2) My second question is to do with threads.
public class foo extends Thread implements Runnable {
public void run() { };
}
As both Thread & Runnable have run() as abstract, is it ok for Foo to
provide
definition of run as above ?
If correct, is the run assoicated with Thread abstract method of the
Runnable abstract method.
Thank all for you help.
Pete