Built-in packages

Built-in packages

These are the package which are already available in java language. These packages provide almost all necessary classes, interfaces and methods for the programmer to perform any task in his programs. Here we introduce some of the important packages of java:

java.lang – basic language functionality and fundamental types
java.io – file operations
java.util – collection data structure classes
java.math – multiprecision arithmetics
java.net – networking operations, sockets, DNS lookups
java.sql – Java Database Connectivity (JDBC) to access databases
java.awt – basic hierarchy of packages for native GUI components
javax.swing – hierarchy of packages for platform-independent rich GUI components
java.applet – classes for creating an applet
java.nio – the New I/O framework for Java
java.security – key generation, encryption and decryption

Example
import java.lang.Math;
class test
{
public static void main(String args[])
{
double val = 25.0;
double sqroot = Math.sqrt(val);
System.out.println(“Square root of ” + val + ” is ” + sqroot);
}
}

Output:
Square root of 25.0 is 5.0

Leave a Reply

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