anand raman

Ranch Hand
+ Follow
since Jun 06, 2001
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 anand raman

well the answer lies in the finalize bit..
Before the object is garbage collected finalize will be called (that is if it is called). In the finalize method the reference to the object can be stored to a static reference variable and thus the object can be resurrected..
However there is no good reason why this should be done..
Hope this helps
Anand
The very same example was discussed a few days back.. Can u please search the archive..
Thanks
Anand
hi
There is a object monitor and a class monitor.
So when the thread executes a syncronized instance method it acquires a object monitor and preventes other threads from entering other syncronized methods of the object.
The same is the case with static methods. When it enters a syn. static method it acquires a class monitor and prevents other threads from entering sync. static methods.
These 2 monitors are different.
Hope this helps
-Anand
Thanks Raghav for the explanation.
Whats unary promotion.
-Anand
sorry for the spam.. never realized that the dumb browser was submitting it multiple times.
-Anand
hi guys
why should this thing work

I thought this would not compile, but it does.
My thoughts on the path of execution are
1. long l cause the int i to be implicitly be a long.
2. After this implicit conversion the left shift happens and the result is a long.
How can it be cast to a int again..
Can some one please correct me.
Thanks for ur time.
-Anand
hi guys
why should this thing work

I thought this would not compile, but it does.
My thoughts on the path of execution are
1. long l cause the int i to be implicitly be a long.
2. After this implicit conversion the left shift happens and the result is a long.
How can it be cast to a int again..
Can some one please correct me.
Thanks for ur time.
-Anand
hi guys
Whats the use for declaring a constructor as protected.
When constructors can be overriden or inherited whats the use for declaring a constructor protected.
-Thanks
Anand
I stand corrected..
"a" and "c" are the right answers.
Thanks
Anand
static member variables are transient. While persisting objects the static member variables are not persisted.
-Anand

getArray()[index =2]++;


will be translated to
null[index=2]++
null[2]++
which basically tries to increment the 3 rd element of a null array.
This will throw a null pointer exception which is caught by the exception block
Hope this helps
-Anand
A small correction to the previous answer.

I2 i2=(I2)i1; since casting given it's fine


A cast is also checked during compile time. If the classes dont have any common subclas then it is a compile type error. However in the above case since I1 and I2 have a common subclass in C3, the cast is allowed.
Take a look at this example. This will result in a compile time error.


Hope this helps
a,b,c works fine.
d and e will cause problems as they conflict with the class name
Hope this helps
-Anand
hi
Can pany one explain what "shadow" means. Somehow miss the entire context.
-Anand
hi
You cant pass in a parameter to the run method, because if you do so in the code, you will end up overloading the method rather than overriding it.
-Anand