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 change the priority of thread or how to set the priority of thread?

0 Answers  


Write the program numbers into words.For example 2345==two thousand three hundred fourty five

2 Answers   TCS,


What are the advantages of exception handling?

0 Answers  


What is the use of string and stringbuffer?

0 Answers  


What is the difference between Static and final?

1 Answers  






how does multithreading take place on a computer with a single cpu? : Java thread

0 Answers  


List some important features of java 10 release?

0 Answers  


List the features of java programming language.

0 Answers  


how to transactions(Bank transactions) in business process in ejb?

1 Answers   Photon,


Write a regular expression to validate a password. A password must start with an alphabet and followed by alphanumeric characters; its length must be in between 8 to 20.

0 Answers  


Can java run on google chrome?

0 Answers  


What is a double?

0 Answers  


Categories