Packages
Packages are used to group related classes and interfaces together. The package
keyword is used to group a class or interface into a package.
Java Common Packages
Packages in the Java language itself begin with the java.
or javax.
. The Java Platform classes are organized into packages, here are the some common packages :
java.lang
This package provides the classes fundamental to the design of the Java programming language. The classes in this package are automatically available. There's no need to import them.
All primitive types are defined in this package. Here are some classes defined in the java.lang
package :
Boolean
Byte
Character
Double
Float
Integer
Long
Math
Number
Object
String
Thread
java.io
The package provides for system input and output through data stream , serialization and the file system. Some classes in the package are :
BufferedInputStream
BufferedOutputStream
BufferedReader
BufferedWriter
Console
File
fileReader
FileWriter
InputStream
InputStreamReader
OutputStream
OutputStreamWriter
Reader
StringReader
Writer
java.util
Contains the collection framework, legacy collection classes, event model, date and time facilities, internationalization and miscellaneous utility classes(a string tokenizer, a random-number generator and a bit array).
Some classes and interfaces in the package are :
Collection<E>
Comparator<T>
List<E>
Map<K,V>
Queue<E>
Set<E>
Arrays
ArrayList<E>
Date
Collections
Dictionary<K,V>
LinkedList<E>
Scanner
UUID
java.text
Contains classes and interfaces for handling text, dates, numbers, and messages in a manner independent of natural languages.
Some classes in the package are :
Annotation
DateFormat
DecimalFormat
NumberFormat
SimpleDateFormat