Ankur kothari

Ranch Hand
+ Follow
since Sep 06, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ankur kothari

leave it...why dont either of you simply show me the calculation step by step...the answer is 16....maybe Ankit or Henry could explain properly
ok so correct me if am wrong

here x is 6;
x+=3 + ++x;

so Chandana according to you it would be x+=3+ 7; which evaluates to x+=10;

which is x=x+10;

which is x=10+7; right? or 10+6?
neha can you explain in detail?
so the output should be 17 right Chandana?
maybe its becasue the operands are evaluated from left to right....

i think this is x+= (AN_INT) + (++x).....first += is opened up soit is

its x=(x) + (AN_INT) + (++x)

this is simply so confusing
maybe its becasue its x*(7+5) becasue of that rule agian
then why is x*=7+5; not x=x*7+5; ?


here x is 84....according to K&B right of += is calculated first...

so minhaj i think your answer should be x+=3+7; which is x=7+10...17

then why 16? hmmmm
i think its because of ( x += AN_INT)+((++x))) becasue +comes first in the hierarchy
here char one =1; is converted to char one=(char)1 by the compiler because 1 is a compile time constant....

if you had final int i=1;
char one=i; even this would compile because i is a compile time constant here too

but this casting isnt done when a compile time constant isnt present
it wasnt a mock question....i was trying it myself....just thought of it


why does java Yipee does not give me null pointer exception? whereas



this does.....
dude the static method is inherited but does not follow overridden rules? like you cant refer to the subclass static method using superclass variable