How can one prove that the array is not null but empty? - JAVA Interview Questions

How can one prove that the array is not null but empty?


Print array.length. It will print 0. That means it is empty. But if it would have been null then it would have thrown a NullPointerException on attempting to print array.length.



Click Here to See Answer .....
Did you like this article ?
Subscribe to my RSS feed and get more JAVA Question, and Guideline, Plus a lot more great advice to help your Software Career.

0 comments:

Related JAVA Questions Posts