kfu

Greenhorn
+ Follow
since Aug 08, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by kfu

Hi,everyone!
Thanks God and all JavaRanch friends!
I am a SCJP now and I still cannot believe it.
I passed wiht 88%. I think I am a little disappointed by
this grade but I am very happy I passed. It is a really
shining beginning for a 21 year-old boy who decided to
devote himself in Java career.
I think the exam is not so
hard but also not easy. For some
question, I don't like the words they use. When you are
taking the test, just be careful with words "before", "after"
"must", "can", and "not".
A lot of Event questions.
A lot of Language Fundation questions.
one I/O question.
About five overlanding, overridding question.
Few AWT questions.
Two GC questions.
Rest I cannot recall.
Thanks for all Javaranch friends again!
Kevin Fu
Hi, friends:
In Khalid and Rolf's A programmer's guide to Java Certification (p715), the question 44 confused me.

c) The mehthod notify() is synchronized.

The given answer says it is not ture because notify() is not synchronized. But I thought notify() and notfiyAll()are synchronized and, in Bill's Exam Cram (p178), the table says
wait(), notify() and notifyALL() are synchronized.
Can anyone tell me whether notify()is synchronized or not?

Thanks for help
Kevin Fu



Hi, yanish:

If you read Bill's question carefully, you will find it says "either as a menu bar or pop-up menu, attached to it". The word
"or" make answers a, b, c, d all correct. From API, there is a add(PopupMenu popup) function in Component class. Since Frame, Window, Applet, Panel are grandchildern of Components, all the answers will be right.
Kevin Fu
For first one (old fashion question!), after you call inc.fermin(i), the parameter passed in is the copy of i not i itself. So after line 5, i is still
0. Also in line 6, the '=' operator happens before i++ operation.
This is a "from left to right" sitiutaton.

For second one, the answer is correct and I don't see why you think Line 11 should be printed out.
Hope it will help
Kevin Fu
How can I go deep to view the source code of
equals function of String class?
Thanks for help.
Kevin Fu
Vasansrini, Thanks for the help.
Kevin
The output is prefect right.
99%32 is 3 and i=1, therefore
the result of 1<<3 is 8.

Kevin
Two qestions about gb:
1)
/***********************************/
public class Test{
public static void main(String[] args) {
Object a = new Object();
Object b = new Object();
Object c = new Object();
Object d = new Object();
d=c=b=a;
d=null;

}
}
/***********************************/
How many objects will be eligible for garbage
collection after line d=null;?

2)
If object obj1 is accessible from object obj2
and object obj2 is accessible from object obj1,
then obj1 and obj2 are not eligible for garbage
collection.
I thought the statement was right and why is
it wrong? Why circular references do not prevent
objects from being gargage collected?
Thanks for help
Kevin