HOW CAN ONE PROVE THAT THE ARRAY IS NOT NULL BUT EMPTY USING ONE LINE OF CODE?

Sumit Kesarwani

Total Post:782

Points:3910
Posted by  Sumit Kesarwani
Java 
 1134  View(s)
Ratings:
Rate this:
  1. Sumit Kesarwani

    Post:782

    Points:3910
    How can one prove that the array is not null but empty using one line of code?

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!