A good answer might be:

   if ( array.length != 0 )
    {
      System.out.println("The total is:   " + total );
      System.out.println("The average is: " + total / array.length  );
    }      
    else
      System.out.println("The array contains no elements." );

End of the Chapter

That about wraps it up for this chapter. You may wish to review the following topics, unless you are already maxed out. Click on a blue subject that interests you to go to where it was discussed. To get back here, click on the "back arrow" button of your browser.

The next chapter will continute the discussion of arrays.


Click here to go back to the main menu.
You have reached the End.