Cindy Yang

Greenhorn
+ Follow
since Aug 24, 2001
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 Cindy Yang

Hi,
I did the exam here: http://www.javaranch.com/maha/_Mock_Exams/JohnJuntMockExam.htm
I don't understand Q34. Why the answers are A,B,C,D?
------------------------------------------------------
Q. 34
Which methods may cause a thread to stop executing?
A.sleep();
B.stop();
C.yield();
D.wait();
E.notify();
F.notifyAll()
G.synchronized()
Select all correct answers.
---------------------------------------------------------
According to Mock Exam in Khalid's book,
Q11:Under which circumstance will a thread stop?
(a) The method waitforId() in class MediaTracker is called.
(b) The run() method that the thread is executing ends.
(3) The call to the start() method of the Thread object returns.
(d) The suspend() method is called on the Thread object.
(e) The wait() method is called on the Thread object.
The answer to Q11 is (b). As Khalid's explaination, Calls to methods suspend(), sleep() and wait() do not stop a thread. they only cause a thread to move out of its running state.
so, why in John Hunt answer,A C D are correct?
I am confused.
Thanks.

Cindy

Hi there,
Could some one explain why the following codes work?
1.
byte b1=(int) 16.2; //1 compile fine
System.out.println(b1);
2.
byte b2=(int)10; //2 compile fine
System.out.println(b2);
3.
int i=10;
byte b3=(int)i; //3 compiler error
System.out.println(b3);
Why code1&2 are fine?
Thanks.
Thank you. I am clear now.
When I did that question, I thought the inner class in the question could be either static or non-static...
So, I need to pay attention to the trick.

Cindy
Hi, there,
There is question(#136) in Java Rule Round-up game:
True or False:
An inner class has free access to private member data of the outer classes.
The answer is True. Why?
According to Khalid's "A programmer's Guide to Java Certification" (p239), if an inner class is located inside an static method(static local class), the inner class can only access static member of outer class.
Can anybody explain that for me?
Thanks a lot.

Cindy
Hi, there,
Could you explain why the results of following code are same?

I run the code , there is no difference in the results, why?
Thanks.
Cindy
(edited to format code)

[This message has been edited by Cindy Glass (edited August 29, 2001).]
22 years ago
Thanks, Bill.
i almost got it. But I am still not clear about " i<<=-4 is same as i<<=28". Could you explain that in detail?
is it because int is 32 bits, therefore, -4+32 = 28. Is it right?
For data type long, it is 64 bits, so, l<<=-4 is same to l<<=60. Am I right? correct me.
Can I use this as a formula when shifting negative bits?
Thanks a lot.
Cindy

Originally posted by Bill Tripper:
[B]
which yields the result:
i = 15, j = 1073741822
by the following logic.
i = -8 is binary 11111111111111111111111111111000.
Shift it -4 is the same as shift it 28 which is binary 00000000000000000000000000001111 which is 15.
j = -8 which is binary 11111111111111111111111111111000
Shift it -30 is the same as shift it 2 which is binary 00111111111111111111111111111110 which is 1073741822.
Bill
[/B]


22 years ago
can anybody explain in detail how to do following code? I have trouble when using shift operator on negative.
int i = -8, j = -8;
i >>= -4;
j >>= -34;
i=?
j=?
Thanks.
Cindy
22 years ago