Ganesh Pujar

Ranch Hand
+ Follow
since Mar 22, 2006
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 Ganesh Pujar

use first and then rs.getInt()
Hi Trupti,

New book is in Market.
Things to DO
1. Read K&B
2. Write lot of code pieces
3. Visit this site regularly
4. Read JLS (Optional, but suggested)

And all the best!
[ November 14, 2006: Message edited by: Ganesh Pujar ]
May be through Anonymous Constructors, i tried it, but i think i'm in wrong path.
Please answer it Sharma Ji
Compiler helps!

Above code does not work for BOTH

So that means, we dont have the answer for the ABOVE yet.
Any explenations for the second? please.
Some changes in the code, but the o/p is still the same!
Lets look @ this first

In both main and run method we are syn on the myrunnable object, so @ any give time one has run complete before the other runs
Keeping that in mind,

Before calling start, main thread syn on myrunnable, so this block has to be completed first.
And then the run method runs.

Ranchers Please correct me if i'm wrong.
Hi above,

check this out from JLS

15.24 Conditional-Or Operator ||
The || operator is like | (�15.22.2), but evaluates its right-hand operand only if the value of its left-hand operand is false. It is syntactically left-associative (it groups left-to-right). It is fully associative with respect to both side effects and result value; that is, for any expressions a, b, and c, evaluation of the expression ((a)||(b))||(c) produces the same result, with the same side effects occurring in the same order, as evaluation of the expression (a)||((b)||(c)).

ConditionalOrExpression || ConditionalAndExpression

Each operand of || must be of type boolean or Boolean, or a compile-time error occurs. The type of a conditional-or expression is always boolean.
At run time, the left-hand operand expression is evaluated first; if the result has type Boolean, it is subjected to unboxing conversion (�5.1.8); if the resulting value is true, the value of the conditional-or expression is true and the right-hand operand expression is not evaluated. If the value of the left-hand operand is false, then the right-hand expression is evaluated; if the result has type Boolean, it is subjected to unboxing conversion (�5.1.8); the resulting value becomes the value of the conditional-or expression.

Thus, || computes the same result as | on boolean or Boolean operands. It differs only in that the right-hand operand expression is evaluated conditionally rather than always.

Please help me on this!
Nor does this compile
Can anyone tell us the reason WHY?

Let me try to explae you.

Line 4 will call function on Line 2, and the Line 3 will be excuted as follows
OuterTest . this . id whcih can be looked as
OuterTest-->CurrentlyExceutingThread-->its id
So which makes it as which is STP

To get the default as output in the last line, you have to change the Line 1 to
static String id ;

Correct me if i'm wrong.

This compiles, but the if condition at LINE x1 returns false all the time. I think it should return false,
only for the call at LINE x2


This does not even compile, because of condition at LINE x1.

Can anyone let me know
1.The difference between Code blk 1 & 2
2. Why do Code blk 1, LINE x1 returns false
3. How to do write the code to make sure the comparision is done, only when both x & y are comparable.
Sorry! How the second version gets into infinite loop?
Hi all,

If any one wants to sell the exam voucher, plz let me know.

And let me know any good offers available at present.

Thank you,