Moya Green

Ranch Hand
+ Follow
since Jan 24, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Moya Green

Hi Everyone,
I passed the 310-025 exam this morning. I would like to take this opportunity to thank all the people here from my heart. You are professional, responsible and warm-hearted. Your help means a lot to me. Thank you very much.
Moya
21 years ago
G Jha and Shishio,
Thanks for the detailed explaination. I get it. I appreciate your help very much!
Moya
http://www.jiris.com/ Mock 2 Q57:
Which of the following outputs are predictable in all platform? (Select two correct answers)
Assume t1, t2 are all newly created valid Thread objects.
---------------------
A:
t1.start();
t1.join();
t2.start();
t2.join();
B:
t1.start();
t2.start();
t1.join();
t2.join();
C:
t1.run();
t2.run();
t1.join();
t2.join();
D:
t1.join();
t2.join();
t1.start();
t2.start();
--------------------------------
The answers are A C. Can anyone help me expalin this? Thanks a lot!
Moya
http://www.jiris.com/
mockexam 2 Question 41:
---------------------------

-------------------------------
The output is:
equal unequal equal equal equal
What is special for
compare(Integer.MAX_VALUE,Integer.MAX_VALUE );
Please help. Thank you.
Moya
[ Jess added UBB [CODE] tags to preserve whitespace ]
[ September 27, 2002: Message edited by: Jessica Sant ]
Clear.
Thank you very much, everyone! You ar ethe best!
Moya
Can you briefly explain how the code compile step by step? I did not get your points. Thanks again. I appreciate it.
Moya
http://www.jiris.com/
mockexam 2 Question 27:
---------------------------------
import java.io.*;
public class Test027
{
public static void main(String args[]) {
System.out.println(method());
}
static int method() {
try {
throw new IOException();
}
catch (IOException ioe) {
System.out.println("0");
return 0;
}
finally {
System.out.println("1");
return 1;
}
return 2;
}
}
------------------------------------
During compiling, error occurred with "unreachable statement, return 2". I thought new IOException was thrown in try block, then catch block caught it and returned "0". Apparently it did not work like that. Can any one explain this? Thank you very much!
Moya
Anthony,
Good explaination! Thank you so much.
Moya
http://home.att.net/~p.durairaj/myexam.html
Q#14. Consider the code bellow.
class WF {
private final void f() {
System.out.println("WF.f()");
}
private void g() {
System.out.println("WF.g()");
}
}
class OP extends WF {
public final void f() {
System.out.println("OP.f()");
}
public void g() {
System.out.println("OP.g()");
}
}
public class Overriding {
public static void main(String[] args) {
OP op = new OP();
op.f();
op.g();
WF wf = op;
((OP)wf).f();
((OP)wf).g();
}
}
Code complied and run OK. It gave the output of OP.f() OP.g() OP.f() OP.g()
I think final method can not be overriden. But in this code it worked. Can anyone explain this? Thank you in advance!
Moya
I got the following definitions from Sun's Java Programming Language book. I think A-paint() and C-update() might be right answers, but still not 100% sure.
--Moya
---------------------------------------
The paint Method:
Exposure handling occurs automatically and results in a call to the paint method. A facility of the Graphic class, called a clip rectangle, is used to optimize the paint method so that updates are restricted to the region that has been damaged.
The update Method:
The repaint method actually caused the AWT thread to call another method, update. The update method usually clears the current display and calls paint.
-------------------------------------------
Here is the question:
Which one or more are normally invoked by AWT to perform redrawing in response to an area of a Component being exposed?
A. paint()
B. repaint();
C. update();
I guess the answer is update(), but not sure. Any idea?
Thank you.
Moya
Sharda,
Thanks for your reply. That's a good point.
Moya
Hi Everyone,
Thanks for your reply. Special thanks to Anthony! The examples and link you provided are very helpful.
Moya
Anthony,
Many thanks for your reply. How about static members?
Can Static members of a static inner class be referenced using the class name of the static inner class?
Thanks again.
Moya
Here is the code:
--------------------------
import java.awt.*;

public class Y extends Frame {
public static void main (String [] args)
{
Y x = new Y();
x.pack();
x.setVisible(true);
}

public Y() {
setLayout (new BorderLayout());
Panel p = new Panel ();
add(p, BorderLayout.NORTH);
Button b = new Button ("North");
p.add(b);
Button b1 = new Button ("South");
add(b1, BorderLayout.SOUTH);
}

It compiled and run well. But the output is a bit surprise. The buttons labeled "North" and "South" have the same height. The height of the button labeled "South" does NOT change when the Frame is resized, although its width does change. Why is that? Is it because North and South components get height honored in the BorderLayout? So the buttons "North" and "South" have the preferred height. Please help.
Any input is appreciated.
Moya