which one is more efficient
int x;
1. if(x==null)
2.if(null==x)
state which one either 1 or 2?

Answers were Sorted based on User's Feedback



which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?..

Answer / sudhanshu

1. if (x==null)
is the correct answer.

Is This Answer Correct ?    21 Yes 8 No

which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?..

Answer / sandeep

x is a int,a primitive. it can never be null

Is This Answer Correct ?    9 Yes 3 No

which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?..

Answer / person

neither... they wouldn't compile without explicit Integer cast.

Is This Answer Correct ?    2 Yes 0 No

which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?..

Answer / priyanka

2. if(null==x) is correct

Is This Answer Correct ?    3 Yes 3 No

which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?..

Answer / kishore

1.if (x==null) is correct answer.

Is This Answer Correct ?    5 Yes 6 No

which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?..

Answer / santosh

if the value is null how can we compare it always (x==null)correct

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More Core Java Interview Questions

how to print a numbers from 1 to 100 with out using control structures?

4 Answers   IBM,


What are the features in java?

0 Answers  


What is the difference between the boolean & operator and the && operator in java programming?

0 Answers  


how to compile jsp?

4 Answers   Logica CMG,


How do you relate a Interface to a Class? Tell me in Detail?

4 Answers  






What is close method? How it's different from Finalize & Dispose?

0 Answers   InfoAxon Technologies,


Define packages in java?

0 Answers  


List some java keywords sun like c, c + + keywords?

0 Answers  


What are the differences between c++ and java?

0 Answers  


Tell me the difference between an applet and a Japplet?

1 Answers  


can we take more than one null values for Unique constraints.

1 Answers   3i Infotech,


Explain different states of a thread in java?

0 Answers  


Categories