90 likes | 229 Views
JAVA API Classes. - Scanner - String - wrapper classes (especially Integer) - NumberFormat - DecimalFormat - ArrayList - File output. Wrapper Class. Boolean, byte, char, double, float, int, long, short void. Object oriented vs. efficiency.
E N D
JAVA API Classes - Scanner - String - wrapper classes (especially Integer) - NumberFormat - DecimalFormat - ArrayList - File output
Wrapper Class • Boolean, byte, char, double, float, int, long, short • void Object oriented vs. efficiency numerical values are needed but objects instead of primitives are required
Wrapper Classes • Primitive data types • boolean • byte • char • double • float • int • long • short • void java.lang.Boolean java.lang.Byte java.lang.Char java.lang.Double java.lang.Float java.lang.Integer java.lang.Long java.lang.Short Java.lang.Void
double d = 5.0; Double aD = new Double(d); double r = aD.doubleValue();
NumberFormat class • java.text package • provide generic formatting capabilities • static : do not need to instantiate
Decimal Format • instantiate using new operator
printf method • print • println • printf (format string, value) • System.out.printf(“ ID: %5d\tName: %s”, id, name)
ArrayList • java.util package • it can dynamically grow and shrink • no type : stores a list of references, meaning primitive value -> wrapper class