Basic Packages of Java - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Basic Packages of Java

Description:

To give information about class or interface related to specific object. java. ... Provide abstraction to deal with the file name and path name dependent on the ... – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 20
Provided by: ebizUa
Category:

less

Transcript and Presenter's Notes

Title: Basic Packages of Java


1
Basic Packages of Java Utility Classes
java.lang Package java.util Package java.io
Package
2
Package
  • To group into one unit classes and interfaces
    related to each other
  • Provide packages for classes or interfaces to be
    used frequently
  • Basic Packages
  • java.lang, java.util, java.io, java.net, java.awt

3
Java Basic Packages
4
JDK Packages
5
java.lang Package
  • Included by Java Compiler without import
    statement
  • Interfaces and Classes provided by java.lang
    package

6
java.lang Package
  • Math Class
  • Provide the methods and constants for the
    mathematic calculation
  • MathClass.java
  • Runtime Class
  • Methods to interface between program execution
    environment and programs
  • RuntimeClass.java

7
java.lang Package
  • Thread Class
  • Class with methods for implementing a
    multi-thread program
  • ThreadGroup Class
  • Class to deal with threads as a group
  • Class class
  • To give information about class or interface
    related to specific object

8
java.util Package
  • Package to provide useful utility class
  • Provide a class to support various standard
    programming data structure
  • Package Structure
  • Hierarchical Structure of Package

9
java.util Package
  • Enumeration Interface
  • Interface for dealing with the enumerated
    elements
  • EnumerationInterface.java
  • BitSet Class
  • Class to deal with bit set resizing dynamically
  • BitSetClass.java
  • Vector Class
  • Class providing data structures having the
    elements to be accessed through integer index as
    array
  • VectorClass.java

10
java.util Package
  • Stack Class
  • Provide methods to manage a stack
  • StackClass.java
  • Hashtable Class
  • Manage a Hashtable to store data and search it
    using given key
  • HashtableClass.java
  • Random Class
  • Methods to generate the random number
  • RandomClass.java

11
java.util Package
  • StringTokenizer Class
  • To give the methods to tokenize a given string by
    delimiter such as blank or specified string
  • StringTokenizerClass.java
  • Date Class
  • Class with the methods related to date and time

12
java.io Package
  • I/O Function based on Stream Class
  • Carried out I/O independent off specific OS
  • Abstract Class InputStream, OutputStream
  • Hierarchical Structure of Class
  • Interfaces and Classes included in Package

13
java.io Package
  • InputStream Class
  • Super Class of all InputStream Class
  • Abstract Class to provide basic methods related
    to input
  • OutputStream Class
  • Abstract Class providing the basic methods
    related to output

14
java.io Package
  • DataInputStream DataOutputStream Class
  • Class to define the methods carrying out I/O to
    basic type
  • Class implemented by being inherited from
    DataInput interface and DataOutput interface

15
java.io Package
  • PipedInputStream class PipedOutputStream class
  • Class to use the output of one thread as the
    input of other thread
  • BufferedInputStream BufferedOutputStream Class
  • Place a buffer in the middle of I/O operation to
    avoid direct access to I/O stream

16
java.io Package
  • FileInputStream FileOutputStream Class
  • FileInputStream Class
  • To read the data from file
  • If cannot open file, Throw FileNotFoundException
  • FileOutputStream Class
  • To write the data to file
  • FilterInputStream FilterOutputStream Class
  • Give methods to modify the data additionally when
    reading/writing data

17
java.io Package
  • ByteArrayInputStream ByteArrayOutputStream
    Class
  • Class to use byte array as input object of input
    stream or output object of output stream
  • Not blocked, unlike other I/O streams
  • PrintStream Class
  • To output the data as text form, this was
    implemented by extending FilterOutputStream class

18
java.io Package
  • File RandomAccessFile Class
  • File Class
  • Provide abstraction to deal with the file name
    and path name dependent on the host platform as a
    file name and path name independent of the
    machine
  • RandomAccessFile Class
  • Provide random access file system to support the
    various mechanisms than FileStream does

19
java.io Package(Example)
  • FileInputStream
  • FileInputStream stream variable new
    FileInputStream(file Specification)
  • InputStreamReader reader variable new
    InputStreamReader(stream variable)
  • StreamTokenizer token_variable new
    StreamTokenizer(reader_variable)
  • FileOutputStream
  • FileOutputStream stream variable new
    FileOutputStream(file Specification)
  • PrinterWriter printer variable new
    PrinterWriter(stream variable)
  • Example StreamTest.java
  • IO Package will be explained in I/O Stream Chapter
Write a Comment
User Comments (0)
About PowerShow.com