Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How can you test a number in java to see if it is null? if(anInt == null) does not work.?

3 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    if (Integer.isInteger(anInt))

  • 1 decade ago

    As a general rule, you should try to initialize your variable to something, and test to see if (anInt == initialVal). Depending on your app, your initialVal can be 0, -9999, or something else that should not show up in your app.

  • 1 decade ago

    try: if (anInt='')

    ''-empty value

Still have questions? Get your answers by asking now.