Using Math Class in Java


Math class provides basic math functions such as max, min, sqrt, abs, etc.

Source Code

System.out.println(Math.max(5, 10)); // Find larger of two numbers
System.out.println(Math.sqrt(64)); // Square root
System.out.println(Math.abs(-4.7)); // Absolute value
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments