1 / 9

JAVA API Classes

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.

shelly-chen
Download Presentation

JAVA API Classes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JAVA API Classes - Scanner - String - wrapper classes (especially Integer) - NumberFormat - DecimalFormat - ArrayList - File output

  2. 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

  3. 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

  4. double d = 5.0; Double aD = new Double(d); double r = aD.doubleValue();

  5. NumberFormat class • java.text package • provide generic formatting capabilities • static : do not need to instantiate

  6. Decimal Format • instantiate using new operator

  7. printf method • print • println • printf (format string, value) • System.out.printf(“ ID: %5d\tName: %s”, id, name)

  8. ArrayList • java.util package • it can dynamically grow and shrink • no type : stores a list of references, meaning primitive value -> wrapper class

  9. Output to file

More Related