Home > DeveloperSection > Interviews > How can one prove that the array is not null but empty using one line of code?

Posted on    August-23-2014 6:08 AM

 Java Java 
 1 Answer(s)
  1057  View(s)
Rate this:

Sumit Kesarwani

Total Post:782

Posted on    August-23-2014 12:00 AM

Print args.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 args.length.

Don't want to miss updates? Please click the below button!

Follow MindStick