library classes
DESCRIPTION
library classesTRANSCRIPT
![Page 1: Library classes](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/1.jpg)
Library classes
![Page 2: Library classes](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/2.jpg)
Class creation
• User defined (if the user creates)
• Library classes (Readily available with the system)
![Page 3: Library classes](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/3.jpg)
LIST OF LIBRARY CLASSES
• Java.io
• Java.lang
• Java.awt
• Java.util
• Java.applet
• Java.net
• Java.math
![Page 4: Library classes](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/4.jpg)
Input operations in java
• System.in.read();
• In.readLine();
![Page 5: Library classes](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/5.jpg)
Output operations in java
• System.out.print();
• System.out.println();
![Page 6: Library classes](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/6.jpg)
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](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/7.jpg)
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](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/8.jpg)
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](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/9.jpg)
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](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/10.jpg)
Throws Keyword
Applied with the function signature
Throws IOException
If error occurs it will report to the error handler
![Page 11: Library classes](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/11.jpg)
Wrapper classes
• It is a member of java library
• It wraps the primitive data type in an object
![Page 12: Library classes](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/12.jpg)
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](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/13.jpg)
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](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/14.jpg)
Static member methods
• Method which uses only static data members or static instant variables
![Page 15: Library classes](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/15.jpg)
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](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/16.jpg)
![Page 17: Library classes](https://reader037.vdocument.in/reader037/viewer/2022100600/5562f8d7d8b42a275f8b4868/html5/thumbnails/17.jpg)