1. 学习
  2. /
  3. 课程
  4. /
  5. Introduction to Testing in Java

Connected

练习

Edge cases: Array maximum

Another common programming exercise is about sorting or finding the maximum value in an array. Here is the simplest version of a it, together with a basic solution. The solution is not entirely correct, as it does not handle a key edge case, an empty array, which will result in an exception.

Run the code to see a RuntimeException triggered.

说明

100 XP
  • Click "Run Code" to produce an ArrayIndexOutOfBoundsException and then submit.