It - 506 - Advanced Java Lab Manual Updated
It - 506 - Advanced Java Lab Manual Updated
INFORMATION TECHNOLOGY
LAB MANUAL
Year/Sem : III/V
Total number of
Experiments: 10
Total number of
Turns: 14
2. Write a program to create array list in collection , add, remove , check , & specified 2
index of elements from the given list.
3. Write a java program to iterate through all elements in a hash list. 1
4. Write a java program to create a queue, add some colors & print out the elements of 1
the queue.
5 Write a program to show the concept of Map in collection. 1
7 Write the steps for database Connectivity & Implement a java programs to access 2
database using JDBC
8 Implement Login page using Servlet . 2
PROBLEM DEFINITION:
Write a program to show the concept of Exception handling.
OBJECTIVE:
To understand the concept of Exception handling.
THEORY:
Attached here with.
INPUT SET:
OUTPUT SET:
Attached.
1. Exceptional(that is error) condition that has occurred in a piece of code of java program.
5. Java creates different type of objects in case of different exceptional conditions that describe the cause of
execution.
7. All exceptions are instances of a class extended from Throwable class or its subclass.
8. Generally, a programmer can make new exception by extending the Exception class which is subclass of
Throwable class.
9. Exception handling is managed by five keywords: try,catch, throw, throws and finally.
a. Java “run-time system” are called System-generated exceptions. It is automatically raised by java run-time
system.
Exception Types:
Error Class: Abnormal conditions those can not be handled are called Errors.
Exception Class: Abnormal conditions those can be handled are called Exceptions.
Program 2:
import java.util. Scanner;
class Division{
public static void main (String[] args){
int a,b,result;
Scanner sc=new Scanner(System.in);
System.out.println("Enter input two integers");
a=sc.nextInt();
b=sc.nextInt();
try{
result =a/b;
System.out.println("Result=" +result);
}
catch(ArithmeticException e) {
System.out.println("Exception caught: Division by zero.");
}
}
}
Output:
Program 3:
class Exceptions{
public static void main(String[] args)
{
String languages[]={"C", "C++", "Java", "PHP","Python"};
try{
for(int i=1; i<=5; i++){
System.out.println(languages[i]);
}
}
catch (Exception e){
System.out.println(e);
}
}
}
Output:
Program 4:
/*Finally block is always executed , whether an exception is Thrown or not*/
class Allocate{
public static void main(String[] args){
try{
long data[]=new long[1000000000];
}
catch (Exception e){
System.out.println(e);
}
finally{
System.out.println("Block finally always execute.");
}
}
}
Output:
EXPERIMENT NO.2
Unit/Topic: 2/Collections
PROBLEM DEFINITION:
Write a program to create array list in collection , add, remove , check , & specified index of elements from
the given list.
OBJECTIVE:
To understand the concept of Collection Framework.
THEORY:
Attached here with.
INPUT SET:
OUTPUT SET:
Attached.
Output:
EXPERIMENT NO.3
Unit/Topic: 2/Hash list
PROBLEM DEFINITION:
Write a java program to iterate through all elements in a hash list.
OBJECTIVE:
To understand the concept of hash list in collections
THEORY:
Attached here with.
INPUT SET:
OUTPUT SET:
Attached.
PROBLEM DEFINITION:
Write a java program to create a queue, add some colors & print out the elements of the queue.
OBJECTIVE:
To understand the concept of Queue in collection.
THEORY:
Attached here with.
INPUT SET:
OUTPUT SET:
Attached.
PROBLEM DEFINITION:
Write a program to show the concept of Map in collection.
OBJECTIVE:
To understand the concept of Map in collection.
THEORY:
Attached here with.
INPUT SET:
OUTPUT SET:
Attached.
PROBLEM DEFINITION:
Study of JDBC & its drivers.
OBJECTIVE:
To understand the concept of JDBC
THEORY:
Attached here with.
INPUT SET:
OUTPUT SET:
Attached.
PROBLEM DEFINITION:
Write the steps for database Connectivity & Implement a java programs to access database using JDBC.
OBJECTIVE:
To understand the steps of JDBC Connectivity.
THEORY:
Attached here with.
INPUT SET:
OUTPUT SET:
Attached.
PROBLEM DEFINITION:
Implement Login page using Servlet .
OBJECTIVE:
To understand the concept of Servlet.
THEORY:
Attached here with.
INPUT SET:
OUTPUT SET:
Attached.
PROBLEM DEFINITION:
Implement Registration page using JSP.
OBJECTIVE:
To understand the concept of JSP.
THEORY:
Attached here with.
INPUT SET:
OUTPUT SET:
Attached.
PROBLEM DEFINITION:
Study the following: 1. RMI. 2. MVC Architecture.
OBJECTIVE:
To understand the concept of RMI & MVC.
THEORY:
Attached here with.
INPUT SET:
OUTPUT SET:
Attached.