Gitesh Ramchandani

Ranch Hand
+ Follow
since Feb 28, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Gitesh Ramchandani

Originally posted by Bert Bates:
I'd really like to know that too!





Yes Srividhya, it prints:



By why is that behavior of String so, that the concatenation is happening?

Is it something related to operator precedence?




Gitesh
The following code compiles and runs successfully:



I was thinking as run() is not explicitly defined and implemented, it will give compiler error

Is the compiler intelligent enough to find that a run() method is available in the Thread class, so it is ignoring the implementation of Runnable interface?

Please help,

Thanks,
Gitesh
Questions are selected from a pool of questions
For the following code sample:



The output is:


My doubt is why am I getting the output as above. Why "a == b is " and "Gitesh" are not printed?

Please help.

Thanks,
Gitesh
Thanks Amrit, Henry and Jelle

I happen to miss the deadlock condition in the question, but am clear on the question now.

Thanks,
Gitesh
Hi Amrit,
i'm repeating the question again here:

obj1 and obj2 are accesible to two different threads and the threads are about to call the getLocks() method.
Assume the first thread calls the method getLocks(obj1, obj2).

Which 1 of the following options is true?

Options




From the answer, which you are saying to be correct, the question should be "How thread2 can avoid any chances of deadlock situation with thread1?"

Correct me if i am getting it wrong?



No, the question is not about avoiding deadlock.

Hope someone helps with the question :roll:

Regards,
Gitesh

left-shift << is equivalent to multiplying the number by 2,4,8...respectively for shifting by 1,2,3....positions



OR

Or stating more simply left-shifting a value by n positions, is the same as multiplying it by 2^n



For example:

***********************************************************************

right-shift >>/>>> is equivalent to dividing the number by 2,4,8...respectively for shifting by 1,2,3....positions



OR

Or stating more simply right-shifting a value by n positions, is the same as dividing it by 2^n



For example:



and so on...

But in case of right-shift [>>] for a negative number, the above shortcuts do not apply.

Regards,
Gitesh
[ March 20, 2008: Message edited by: Gitesh Ramchandani ]
* if the value of the divisor in floating-point division is 0 no exception is thrown; the value of the results are as follows:
o division of a positive floating-point value: POSITIVE_INFINITY
o division of a negative floating-point value: NEGATIVE_INFINITY
o division of a floating-point value by -0: POSITIVE_INFINITY

Can someone help me with the above posted doubt?

Thanks,
Gitesh
My concern here is that, how to get the value of f, without compiling?

int i = 1234567890;
float f = i;
System.out.println(i);
System.out.println(f);
System.out.println((int)f);

output: 1234567890
1.23456794E9
1234567936

Any help?

Regards,
Gitesh
Consider the following method:



and the following instantiations:



obj1 and obj2 are accesible to two different threads and the threads are about to call the getLocks() method.
Assume the first thread calls the method getLocks(obj1, obj2).

Which of the following is true?

Options

Select 1 correct option.


Ans: The second thread should call getLocks(obj1, obj2)

Doubt: i think that "The second thread may call getLocks() any time and passing parameters in any order." is correct. Could someone clarify my doubt.

Source: (Question ID: 1054) Enthuware

Thanks,
Gitesh
[ March 21, 2008: Message edited by: Gitesh Ramchandani ]