Library classes
Class creation
• User defined (if the user creates)
• Library classes (Readily available with the system)
LIST OF LIBRARY CLASSES
• Java.io
• Java.lang
• Java.awt
• Java.util
• Java.applet
• Java.net
• Java.math
Input operations in java
• System.in.read();
• In.readLine();
Output operations in java
• System.out.print();
• System.out.println();
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
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
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
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
Throws Keyword
Applied with the function signature
Throws IOException
If error occurs it will report to the error handler
Wrapper classes
• It is a member of java library
• It wraps the primitive data type in an object
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);
Static data members
• Instant variables which is global in the class and used commonly by all the objects of that class
Static member methods
• Method which uses only static data members or static instant variables
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