Lecture12 - Class Library, Formatting, Wrapper Classes, and...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Class Library, Formatting, Wrapper Classes, and JUnit Testing Java Class Library (Packages) Formatting Output Wrapper Classes and Autoboxing JUnit Testing Reading for this Lecture: L&L, 3.4 – 3.8
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Class Libraries A class library is a collection of classes that we can use when developing programs The Java standard class library is part of any Java development environment Its classes are not part of the Java language per se, but we rely on them heavily Various classes we've already used ( System , Scanner , String ) are part of the Java standard class library (Look them up on Sun website) Other class libraries can be obtained through third party vendors, or you can create them yourself
Background image of page 2
3 Packages The classes of the Java standard class library are organized into packages Some packages in the standard class library are: Package java.lang java.applet java.awt javax.swing java.net java.util javax.xml.parsers Purpose General support Creating applets for the web Graphics and graphical user interfaces Additional graphics capabilities Network communication Utilities XML document processing
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 The import Declaration When you want to use a class contained in a package, you can use its fully qualified name java.util.Scanner scan = . .. Or you can import the package containing the class and just use the class name Scanner import java.util.Scanner; Scanner scan = . .. To import all classes in a particular package, you can use the * wildcard character import java.util.*;
Background image of page 4
5 The import Declaration All classes of the java.lang package are imported automatically into all programs It's as if all programs contain the following line: import java.lang.*; That's why we didn't have to import the
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/25/2010 for the course CS 110 taught by Professor Wilson during the Spring '10 term at University of Massachusetts Boston.

Page1 / 20

Lecture12 - Class Library, Formatting, Wrapper Classes, and...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online