library classes

17
Library classes

Upload: sonybabu

Post on 25-May-2015

664 views

Category:

Education


0 download

DESCRIPTION

Library classes

TRANSCRIPT

Page 1: Library classes

Library classes

Page 2: Library classes

Class creation

• User defined (if the user creates)

• Library classes (Readily available with the system)

Page 3: Library classes

LIST OF LIBRARY CLASSES

• Java.io

• Java.lang

• Java.awt

• Java.util

• Java.applet

• Java.net

• Java.math

Page 4: Library classes

Input operations in java

• System.in.read();

• In.readLine();

Page 5: Library classes

Output operations in java

• System.out.print();

• System.out.println();

Page 6: Library classes

Types of streams

Input stream related to keyboardInput stream related to keyboard• System.in

Output stream related to VDUOutput stream related to VDU• System.out• System.err

These streams are available in java.io

Page 7: Library classes

Categories of stream

• Character related

Referred as reader stream and writer stream (for character encoding)

• Byte related

Any data in terms of byte can be inputted

Page 8: Library classes

Exception & Exception handling

• An unexpected situation which occurs due to improper use of input resources during the execution of the program

• The process of eliminating unexpected errors during runtime

Page 9: Library classes

TRY and CATCH

Try contains block of statements to perform

An error will be trapped in try block

Hence try is an error trapper

Catch will be informed about the error and catch the errors

Page 10: Library classes

Throws Keyword

Applied with the function signature

Throws IOException

If error occurs it will report to the error handler

Page 11: Library classes

Wrapper classes

• It is a member of java library

• It wraps the primitive data type in an object

Page 12: Library classes

Need of Wrapper class

• To store primitive values in objects as well as in conversion from string to primitive types

• Ex :

• String x = “12”;

• int c =Integer.parseInt(x);

Page 13: Library classes

Static data members

• Instant variables which is global in the class and used commonly by all the objects of that class

Page 14: Library classes

Static member methods

• Method which uses only static data members or static instant variables

Page 15: Library classes

Packages in java

• It is a group of class which can be imported to a program to use implicit facilities

• It can be included by using import keyword

• A package may be defined by the user and is termed as user defined packages

Page 16: Library classes
Page 17: Library classes