” In any right triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle). “
Pythagoras Theorem, Wikipedia
One of our member students was asked to implement the Pythagoras Theorem using Java. This is a good opportunity to introduce the Math class which contains a collection of static methods for various mathematical functions.
We need the square root method (sort) to calculate the hypotenuse, and can also use the pow() method to calculate the base.