Dmitryi Neverov

Greenhorn
+ Follow
since Nov 28, 2005
Merit badge: grant badges
For More
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 Dmitryi Neverov

Hi! I have problem with inserting Date parameter in iBatis statement:


How can I insert in the (1) posision Date parameter? Then I try to:


#strDate# is string representation of the Date, I got error.

Then I try to:

I also get error.
Can anyone say there is my error?
Thanx.
I used KM book (read it 2 times) any all mocks that I can find. Thanx to you all guys, you are THE BEST!
18 years ago
Thanx you for answers!
Explain please the mechanisme of why this


prints 1 instead of 2.

Originally posted by Prash Gali:
Hello uzma,
Since the left most expression is evaluated first, a becomes true. Hence other assignments dont take place which would result in
a = true, b = false, c = false

ranchers correct me if i am wrong.



But why the left most expression is evaluated first, if it has lower precedence than && ?
Thanx.
Yes, I'm using 1.5 jdk, but I'm preparing for 310-035, and didn't know about this behavior of 1.5 jdk.
Explain please why



compiles and works fine (prints "It's work!").
[ January 17, 2006: Message edited by: Dmitryi Neverov ]
I think, answer on first question is C, and on second - B
I try:



output is:
111111111111111111111111111111111111111111111111111111111111111 //63 of 1
1111111111111111111111111111111 //31 of 1
11111111111111111111111111111111 //32 of 1

It seems that Double.POSITIVE_INFINITY first converted to int and then to byte.
[ January 13, 2006: Message edited by: Dmitryi Neverov ]
Hi, explain please why

, but

?
[ January 12, 2006: Message edited by: Dmitryi Neverov ]

Originally posted by Ram Roop:
The code provided here should not give any compilation errors. It would compile and run just fine. The output would be:

2
3
1

The order of execution would be:

1. initilization block execution.
2. member variable assignment.
3. constructor call.

Hope this is helpful.

[ January 12, 2006: Message edited by: Ram Roop ]




Agree, as it doesn't violate declare-before-read rule.

Originally posted 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.



Please explain why in KM book there is phrase

The evaluation order also respects any parentheses, and the precedence and associativity rules of operators.

Doesn't this means that operands of && operator must evaluated before operands of || , as && have higher precedence?
[ January 12, 2006: Message edited by: Dmitryi Neverov ]
If any checked exception is thrown during execution of an initializer expression, it must be caught and handled by code called from the initializer expression. This restriction does not apply to instance initializer expressions in anonymous classes. (KM book)

But why:


then compile, get error:
Khalid's book said that changes in the map are reflected in the views, and vice versa.
Please explain why result of



is:

11
12
13
14//there is no 15
1
2
3
4
5//they are still 1,2,3,4,5 not the 11,12,13,14,15

Underlying map is changed, but the view is not.
And view is changed, but map is not.

Why?