Tuesday , December 6 2016
Home / JAVA / library classes and library functions in Java

library classes and library functions in Java

What are library classes and library functions in Java

Library Classes:- These are the predefined classes provided by Java system present in packages. These classes contain related library functions like String Math, etc. All the library classes belong to some package.

Library Functions:- These are the inbuilt functions present in Java library classes, provided by Java system to help programmers to perform their task in an easier way.

Library Classes are to be included in java program using a package.

Package:-Packages are collection of classes or subclasses. We have different packages defined to import or include the classes required in the Java program.

The different packages are:

1. io package:- It includes all the classes related to input/output.

2. lang package:- It include all the statements and functions common to all program.For eg we have,System.out.println ,main function etc used in all the program.Also lang package is the default package which is by default imported in all the java program.But we can also include this package explicitly.

3. util package:- It includes all the utility classes.For eg like date and time.

4. awt package:- It includes all the classes related to graphical design.

5. sql package:- It includes classes of the database connectivity.

6. applet package:- It includes all the classes related to Internet programming.

7. net package:- It includes all the classes related to networking.

Import Statement:-

This statement is used to add or include the classes related to the package. Import statement should be the first statement of the program.

How to import a package:

Syntax:
Import java.lang.*;
Import java.io.*;

Program to take the input from the user to print the Name and Age of the Employee.

We use BufferedReader class which is in io package to take the input and read it and print the output on the screen.

*Exception occurred when we import the io package .So we use throws Exception to deal with the exception.So that it will not create error in executing the program.

Incoming terms: library classes and library functions

Also See:   Java program for armstrong number using recursion

Check Also

Program for Matrix Multiplication in JAVA

Matrix Multiplication:– Here is given a Java Program for Matrix Multiplication also call matrix product. In ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.