Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Melle Lee

+ Follow
since Nov 17, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Melle Lee

100% on Concurrency and Collections/Generics,
but only 72% and 70% on Flow Control and API contents.

I had only one month to prepare for the exam.

Thanks K&B for the excellent book.
14 years ago
Srinivas Bitla, I think you need to synchronize the inSync() method.
I only know that a nested class (static) does not hold an implicit reference "this" to its enclosing class, but a static method does.
Here is a program I tried. The interface can be declared private.

[ May 22, 2006: Message edited by: Melle Lee ]
A constructor cannot directly or indirectly invoke itself.
According to <<The Java Language Specification>>, if a class has a public superclass or superinterface, with the help of another public class in the same package that returns an instance of this class, instance of the class might be available at run time to codes outside its package, and its public methods, which implement or override the methods of its public superclass or superinterface, can be invoked through these instances.
I am going for SCJP 5.0 because it's the newest version and seems interesting. But I don't know whether Java 1.4 is more widely used.
A type variable for a generic class declaration use only the keyword "extends".

But the parameterized type can use both keywords "super" and "extends".
It's because the program
"throw new Level1Exception();"
before the second "try", so the second "try" is not reachable.
My answer:

B. True
Since setXY() is not synchronized, the following sequence is possible:
setX(1); // the first thread
setX(2); // the second thread
setY(1); // the first thread
setY(2); // the second thread
[ April 16, 2006: Message edited by: Spring ]
I got compile error (x is possibly not initialized) for sample 2:

public class CrazyAssignment{
public static void main(String[] args){
int k;
for (;true||(k=readint())>0 ; ) {}

int x;
for (boolean xF = true;xF || (x=readint())>0 ; ) {
static int readint(){return 1;}
I have checked the answers on my computer.
A4 is valid.