Online Test Banks
Score higher
See Online Test Banks
Learning anything is easy
Browse Online Courses
Mobile Apps
Learning on the go
Explore Mobile Apps
Dummies Store
Shop for books and more
Start Shopping

Math and NumberFormat Classes

Part of the Java All-in-One For Dummies Cheat Sheet

Java classes lay the foundation for your programs. The Java Math and NumberFormat classes let you program number values, as well as format numbers and currencies.

The Math Class
Method Description
num abs(num y); Absolute value of y (num can be any numeric data type)
num max(num y, num z); Maximum of y and z
num min(num y, num z); Minimum of y and z
double = Math. random(); Random number, such that 0.0 < x <= 1.0
The NumberFormat Class
Method Description
NumberFormat getNumberInstance(); Gets an instance that formats numbers.
NumberFormat Gets an instance that formats currency.
String format(x); Formats the specified number.
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

Java All-in-One For Dummies Cheat Sheet


Inside Sweepstakes

Win $500. Easy.