Basic Packages of Java - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Basic Packages of Java

Description:

java.lang Package. Math Class. Provide the methods and constants for the mathematic calculation ... java.lang Package. Thread Class. Class with methods for ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 17
Provided by: ebizUa
Category:
Tags: basic | java | lang | packages

less

Transcript and Presenter's Notes

Title: Basic Packages of Java


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

3
java.lang Package
  • Included by Java Compiler without import
    statement
  • Interfaces and Classes provided by java.lang
    package
  • Table 12.1

4
java.lang Package
  • Math Class
  • Provide the methods and constants for the
    mathematic calculation
  • Ex 12.1
  • Runtime Class
  • Methods to give the interfaces between program
    execution environment and programs
  • Ex 12.2

5
java.lang Package
  • Thread Class
  • Class with methods for implementing the 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

6
java.util Package
  • Package to provide the useful utility class
  • Provide the class to support various standard
    programming data structure
  • Package Structure
  • Table 12.2
  • Hierarchical Structure of Package
  • Fig 12.2

7
java.util Package
  • Enumeration Interface
  • Interface for dealing with the enumerated
    elements
  • Ex 12.3
  • BitSet Class
  • Class to deal with bit set growing dynamically
  • Ex 12.4
  • Vector Class
  • Class having the elements to be accessed through
    integer index as array
  • Ex 12.5

8
java.util Package
  • Stack Class
  • Provide the methods to manage the stack
  • Ex 12.6
  • Hashtable Class
  • Manage the Hashtable to store the data and search
    it using given key
  • Ex 12.7
  • Random Class
  • To have the methods to generate the random number
  • Ex 12.8

9
java.util Package
  • StringTokenizer Class
  • To give the methods to tokenize the given string
    by delimiter such as blank or specified string
  • Ex 12.9
  • Date Class
  • Class with the methods related to data and time

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

11
java.io Package
  • InputStream Class
  • Super Class of all Input Stream Class
  • Abstract Class to provide the basic methods
    related to input
  • Ex 12.10
  • OutputStream Class
  • Abstract Class to give the basic methods related
    to output

12
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
  • Methods regarding the data type which is related
    to input and output
  • ? 12.4 ??

13
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 the buffer at the middle for I/O operation
    to avoid the direct access to I/O stream

PipedOutputStream Output new
PipedOutputStream() PipedInputStream Input
new PipedInputStream(Output)
14
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
  • Ex 12.11
  • FilterInputStream FilterOutputStream Class
  • Give the methods to modify the data additionally
    when read/write the data

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

16
java.io Package
  • File RandomAccessFile Class
  • File Class
  • Provide the abstraction to deal with the file
    name and path name dependent on the host platform
    as the file name and path name independent on the
    machine
  • RandomAccessFile Class
  • Provide the random access file system to support
    the more various mechanism than FileStream does
Write a Comment
User Comments (0)
About PowerShow.com