Deepthi Rallabandi

Greenhorn
+ Follow
since Aug 17, 2005
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 Deepthi Rallabandi

Hi,

In java always evaluation will be from left to right.

suppose take this expression

2 + 3 * 4 - 1 * 7

here you can think of the operands in expression will be grouped as follows

step 1: 2 + (3 * 4) - (1 * 7) according to precedence rules
step 2: ((2 + (3 * 4)) - (1 * 7)) accrding to associative rules

step 3: for any operator to be applied both operands must be first evaluated.
so as evaluation is from left to write first 2 + (3 * 4) needs to be evaluated.
2+(3*4)=> 2+12=14 then
14 - (1*7)=> 14 - 7 = 7

so final result is 7.


so in your code the grouping will be as follows
(a = true) || (b = true) && (c = true)
=> ((a=true) || ( (b=true) && (c=true) ))
as evaluation will be from left to write
(a=true) is evaluated first which results in true and "a" is assigned value true .
as || is short hand operator if left operand is true, right operand is not evaluated.

so output will be true, false , false as default values for b and c are false.
Hi,

as you have declared "num" as static , by the time Thread "t1" completed it's execution in synchronized block value of "num" becomes 10 which is shared by thread "t2" also.
When t2 enters the synchronized block after t1 released, the value of "num" is 10. So t2 does not enter into the while loop as the condition is failed.
Hi,

'\u000a' and '\u000d' are Unicode values for "newline" and "carriage return" characters. These values should not be used to represent newline and carriage return in the source code. These values are interpreted as line-terminator characters by the compiler, and will cause compile time errors.

we should use the string literals "\n" and "\r", respectively, for correct interpretation of the characters "\u000a" and "\u000d" in the source code.
Hi Philippe,

Congratulations!!!
That's an amazing score..
16 years ago
Hi,

iam also planning to give scjp 1.5.
As there are no proper books available in market until now (K&B book is not yet released) , iam going through the tutorials available on suns site.
For topics covered in scjp 1.4 we can go thru K&B book and khalid mughal book.
If any one likes to discuss and share preparation,they are most welcome.
you can mail me to my id.


Thank you
Deepthi