Rana Thakur

+ Follow
since Feb 26, 2001
Merit badge: grant badges
For More
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 Rana Thakur

Thanks tom. I am also planning to take the exam on 12th.
saw some postings here compaining about java.lang section in exam .
Anyone having JQ+ test ??
I answered
GridLayout layout = new GridLayout(0,1);
Without Quotes
still it says the answer is wrong.
Hi Bill,
Thanks a lot....
As you said
Exactly how the lock mechanism keeps track of the number of times a specific Thread has entered synchronized code in a particular object is up to the implementor of the JVM.
Once a Thread acquires lock for object it can enter any of its synchronized code any number of times without the need for re-acquiring the lock. So it seems to me that a Thread can at most acquire one lock on any object.
What happens if the synchronized code is re-entrant? Does the Thread needs to re-acquire the lock each time it invokes the code. I think no. or am I wrong?

The Deamon Threads that happen to be running when the last user Thread dies are automatically killed so the program can exit.
So the statement
"JVM exits when there are no user threads running" and
"JVM exits when there are no threads running" are same?
because Daemon threads are anyway killed as the last user thread dies.

[This message has been edited by Rana Thakur (edited March 10, 2001).]
[This message has been edited by Rana Thakur (edited March 10, 2001).]
Came across a few posting where people have mentioned that there is some problem of typing the code in the lang section of SJCP2 in quotes and still ending up with 0% in this section. Is there something wrong with the section itself or something being missed? Can anyone who has give the exam confirm this?
Hi Cindy,
Do you mean to say that if there is no an equal or higher priority thread then this thread will not be moved to "ready-to-run" state at all? Or is it that it WILL be moved to ready-to-run state and then the scheduler will run it again?
Oh well it seems that it won't be moved to ready-to-run state.
A thread can voluntarily yield the CPU without going to sleep or some other drastic means by calling the yield method. The yield method gives other threads of the same priority a chance to run. "If there are no equal priority threads that are runnable, then the yield is ignored"

[This message has been edited by Rana Thakur (edited March 10, 2001).]
Q1) If an object can have only one lock, then how come a single thread can obtain multiple locks on one object?
Q2) "Daemon Threads die when all the user threads die." Is it true? I thought Daemon threads are independent of life time of user threads.
[This message has been edited by Rana Thakur (edited March 10, 2001).]
Thanks Jane. I got it.
No Cindy it was regarding Sun's privacy rules.
Constructors can have access modifiers.
They cannot have abstract, static, final, synchronized, native modifers.
Can anyone tell what type of questions can be expected under this title??
Or maybe what siva means is that (in his example), when I call A.CalDifference(B) then CalDifference () of A is being invoked. Inside that function the value of private variable iFeet of object A can be accessed (this.iFeet) and the value of private variable iFeet of object B can be obtained too (feet.iFeet).
Thus in this function not only I can access the iFeet of A (which is invoking this function) but also the private field i.e. iFeet of object B.
And of course, other than the class Feet, say in class PrivateAccessTest, if one tries to access the private variable of any object the compiler will complain.

[This message has been edited by Rana Thakur (edited March 07, 2001).]
Well Shailendra you do have a point there. I read the same statement couple of places and took it to be granted that it is true. One place where I came across this one was Velmurugan Periasamy's notes at page 16 under Modifer topic
"� These modifiers dictate, which classes can access the features. An instance of a class can access the private features of another instance of the same class."
In the example Siva has given, the two objects are accessing their own private members.
What I understand is private variables are the property (state) of an object and there is no way another object can access them.
(thats why they are private!!)
so either the statement is wrong or I am missing out something.
One of the add() methods defined in the Container class has the following signature.
Component add(Component comp)
Adds the specified component to the end of this container.
Since Menu is not a type of Component. (i.e. Menu doesnot inherit from Component, inherits from MenuComponent), it cannot be used to invoke the add() method of Container class, hence cannot be added to a Container.
Can anyone give an example of how an instance of a class can access the private features of another instance of the same class??