0% found this document useful (0 votes)
3 views32 pages

Java Record

It consists of Java programs
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views32 pages

Java Record

It consists of Java programs
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java Programming Page No:

1. Program to evaluate quadratic equation

import [Link].*;
import [Link].*;
class Quadra
{
public static void main(String args[]) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader([Link]));
double a, b, c, d, r1, r2;
[Link]("Enter a, b and c values :");
a = [Link]([Link]());
b = [Link]([Link]());
c = [Link]([Link]());
d = b * b - 4 * a * c;
if(d > 0)
{
[Link]("Roots are real: ");
r1 = (-b + [Link](d)) / (2 * a);
r2 = (-b - [Link](d)) / (2 * a);
[Link]("root1 = "+r1+", root2 = "+r2);
}
else if(d == 0)
{
[Link]("Roots are real & Equal:");
r1 = -b / (2 * a);
r2 = -b / (2 * a);
[Link]("root1 = "+r1+", root2 = "+r2);
}
else

[Link]("Roots are Imaginary.");


}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
2. Program to print Fibonacci series of n numbers.

import [Link].*;
class Fibonacci
{
public static void main(String args[]) throws IOException
{
int f1 = 0, f2 = 1, f3;
BufferedReader br = new BufferedReader(new InputStreamReader([Link]));
[Link]("Enter any value for n :");
int n = [Link]([Link]());
[Link](f1+" "+f2);
do
{
f3 = f1 + f2;
if(f3 <= n)
[Link](" "+f3);
f1 = f2;
f2 = f3;
}while(f3 <= n);
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
3. Program to print prime numbers from 1 to n.

import [Link].*;
class Prime
{
public static void main(String args[]) throws IOException
{
int i = 1;
BufferedReader br = new BufferedReader(new InputStreamReader([Link]));
[Link]("Enter any value for n :");
int n = [Link]([Link]());
[Link]("Prime numbers from 1 to n: ");
while(i <= n)
{
int j = 1, found = 0;
while(j <= i)
{
if(i % j == 0)
found++;
j++;
}
if(found == 2)
[Link](" "+i);
i++;
}
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
4. Program to multiply given two matrices.

import [Link].*;
class MatrixMul
{
public static void main(String args[]) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader([Link]));
[Link]("Enter [Link] rows and cols in first matrix :");
int r1 = [Link]([Link]());
int c1 = [Link]([Link]());
int a[][] = new int [r1][c1];
[Link]("Enter the elements: ");
for(int i=0; i<r1; i++)
for(int j=0; j<c1; j++)
a[i][j]=[Link]([Link]());
[Link]("First Matrix :");
for(int i=0;i<r1;i++)
{
for(int j=0;j<c1;j++)
[Link](" "+a[i][j]);
[Link]();
}
[Link]("Enter [Link] rows and cols in second matrix :");
int r2 = [Link]([Link]());
int c2 = [Link]([Link]());
int b[][] = new int[r2][c2];
[Link]("Enter the elements: ");
for(int i=0; i<r2; i++)
for(int j=0; j<c2; j++)
b[i][j] = [Link]([Link]());
[Link]("Matrix Two :");
for(int i=0; i<r2; i++)
{
for(int j=0; j<c2; j++)
[Link](" "+b[i][j]);
[Link]();
}
int c[][] = new int[r1][c2];
if(c1 == r2)
{
[Link]("Multiplication :");
for(int i=0; i<r1; i++)
for(int j=0; j<c2; j++)
{
c[i][j] = 0;
for(int k=0;k<c1;k++)
c[i][j] = c[i][j] + a[i][k] * b[k][j];
}
for(int i=0; i<r1; i++)
{

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
for(int j=0; j<c2; j++)
[Link](" "+c[i][j]);
[Link]();
}
}
else
[Link]("Multiplication is not possible.");
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
5. Program to check the given String is palindrome or not.

import [Link].*;
class StringPalindrome
{
public static void main(String args[]) throws IOException
{
int found = 1;
BufferedReader br = new BufferedReader(new InputStreamReader([Link]));
[Link]("Enter any string :");
String str = [Link]();
int l = [Link]();
for(int i=0, j=l-1; i<=j; i++, j--)
if([Link](i) != [Link](j))
found = 0;
if(found == 1)
[Link]("The given String is Palindrome.");
else
[Link]("The given String is not Palindrome.");
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
6. Program to sort the given list of names in ascending order.

import [Link].*;
import [Link].*;
class StringSort
{
public static void main(String args[])throws IOException
{
String temp;
DataInputStream dis = new DataInputStream([Link]);
BufferedReader br = new BufferedReader(new InputStreamReader([Link]));
[Link]("Enter [Link] Strings :");
int n = [Link]([Link]());
String a[] = new String[n];
[Link]("Enter the strings: ");
for(int i=0; i<n; i++)
a[i] = [Link]();
for(int i=1; i<n; i++)
for(int j=0; j<n-i; j++)
if(a[j].compareTo(a[j+1])>0)
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
[Link]("The sorted string are:");
for(int i=0; i<n; i++)
[Link](a[i]+" ");
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
7. Program for Hierarchical inheritance using abstract class.
abstract class Car
{
int regno;
Car(int r)
{
regno = r;
}
void openTank()
{
[Link]("Fill the Tank.");
}
abstract void steering(int direction, int angle);
abstract void braking(int force);
}
class Maruthi extends Car
{
Maruthi(int regno)
{
super(regno);
}
void steering(int direction, int angle)
{
[Link]("Take a turn..");
[Link]("This is ordinary Steering.");
}
void braking(int force)
{
[Link]("Brakes Applied :");
[Link]("These are hydraulic brakes :");
}
}
class Santro extends Car
{
Santro(int regno)
{
super(regno);
}
void steering(int direction, int angle)
{
[Link]("Take a turn..");
[Link]("This car use power Steering.");
}
void braking(int force)
{
[Link]("Brakes Applied.");
[Link]("These car uses gas brakes.");
}
}
class Hierarchical
{

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
public static void main(String args[])
{
Maruthi m = new Maruthi(1001);
Santro s = new Santro(5005);
Car ref;
ref = m;
[Link]("Maruthi Details: ");
[Link]();
[Link](1,90);
[Link](500);
[Link]("Santro Details: ");
ref = s;
[Link]();
[Link](1,90);
[Link](500);
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
8. Program to achieve multiple inheritance using interfaces.

interface Car
{
int speed = 60;
public void distanceTravelled();
void display();
}
interface Bus
{
int distance = 100;
public void speed();
void display();
}
public class Vehicle implements Car, Bus
{
int distanceTravelled;
int averageSpeed;
public void distanceTravelled()
{
distanceTravelled = speed * distance;
[Link]("Total Distance Travelled is: "+distanceTravelled);
}
public void speed()
{
int averageSpeed = distanceTravelled / speed;
[Link]("Average Speed maintained is: "+averageSpeed);
}
public void display()
{
[Link]("Implementing common method from interfaces");
}
public static void main(String args[])
{
Vehicle v1 = new Vehicle();
[Link]();
[Link]();
[Link]();
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
9. Example program for building blocks of Exception Handling.

class TestExceptions
{
static void myMethod(int testnum) throws Exception
{
[Link] ("Start - myMethod");
if (testnum == 12)
throw new Exception();
[Link]("End - myMethod");
return;
}
public static void main(String args[])
{
int testnum = 12;
try
{
[Link]("try - first statement");
myMethod(testnum);
[Link]("try - last statement");
}
catch (Exception ex)
{
[Link]("An Exception");
}
finally
{
System. out. println("finally") ;
}
[Link]("Out of try/catch/finally - statement");
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
10. Program to create a custom exception.

class MyException extends Exception


{
private static int Accno[] = {1001,1002,1003,1004,1005};
private static String Name[] = {"Anand","Bhanu","Suresh","Venkat","Srinivas"};
private static double Bal[] = {10000.00,12000.00,5600.00,999.00,1100.55};
MyException()
{
}
MyException(String str)
{
super(str);
}
public static void main(String args[])
{
try
{
[Link]("Accno"+"\t"+"Customer"+"\t"+"Balance");
for(int i=0; i<5; i++)
{
[Link](Accno[i]+"\t"+Name[i]+"\t"+Bal[i]);
if(Bal[i] < 1000)
{
MyException me = new MyException("Balance amount is Less:");
throw me;
}
}
}
catch(MyException me)
{
[Link]();
}
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
11. Program to create a package.

[Link]
package pack;
public class Addition
{
private double d1, d2;
public Addition(double a,double b)
{
d1 = a;
d2 = b;
}
public void sum()
{
[Link]("The Addition is :"+(d1+d2));
}
}

[Link]
package pack;
public class Subtraction
{
private double d1, d2;
public Subtraction(double a,double b)
{
d1 = a;
d2 = b;
}
public void sub()
{
[Link]("The Subtraction is :"+(d1-d2));
}
}

[Link]
import [Link];
import [Link];
class MyPackage
{
public static void main(String args[])
{
Addition a = new Addition(10,15.5);
[Link]();
Subtraction s = new Subtraction(10,15.5);
[Link]();
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
12. Program for reading a stream of integers and finding the sum using StringTokenizer

import [Link].*;
import [Link].*;
class StrTokExample
{
public static void main(String[] args)throws IOException
{
String input;
BufferedReader br = new BufferedReader(new InputStreamReader([Link]));
[Link]("Enter the input: ");
input = [Link]();
StringTokenizer st = new StringTokenizer(input, ",");
int sum = 0;
[Link]("The tokens are: ");
while([Link]())
{
int n = [Link]([Link]());
[Link](n);
sum += n;
}
[Link]("Sum = "+sum);
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
13. Program for Stack operations.

import [Link].*;
import [Link].*;
class StackExample
{
public static void main(String args[]) throws IOException
{
int ch = 0;
Stack<Integer> st = new Stack<Integer>();
BufferedReader br = new BufferedReader(new InputStreamReader([Link]));
do
{
[Link]("[Link]()");
[Link]("[Link]()");
[Link]("[Link]()");
[Link]("[Link]()");
[Link]("[Link]()");
[Link]("[Link]()");
[Link]("Enter any choice: ");
ch = [Link]([Link]());
switch(ch)
{
case 1:
[Link]("Enter element: ");
int no = [Link]([Link]());
[Link](no);
break;
case 2:
int ele = [Link]();
[Link]("The deleted element is: "+ele);
break;
case 3:
int top = [Link]();
[Link]("The top most element is: "+top);
break;
case 4:
boolean b = [Link]();
if(b == true)
[Link]("The stack is empty.");
else
[Link]("The stack is not empry.");
break;
case 5:
int se = [Link]([Link]());
int n = [Link](se);
if(n == -1)
[Link]("The element not found.");
else
[Link]("The element found at: "+n);
break;

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
default:
return;
}
[Link]("The elements in Stack are: "+st);
}while(ch != 6);
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
14. Program for HashTable.

import [Link].*;
import [Link].*;
class HashTableExample
{
public static void main(String args[]) throws IOException
{
Hashtable<String, Long> ht = new Hashtable<String, Long>();
[Link]("Vijay", 9876543678L);
[Link]("Raju", 8765745369L);
[Link]("Bhasu", 9985123456L);
[Link]("Anand", 7789657868L);
[Link]("Srinu", 9987896754L);
[Link](ht);
Enumeration e = [Link]();
[Link]("The contacts available: ");
while([Link]())
[Link]([Link]());
BufferedReader br=new BufferedReader(new InputStreamReader([Link]));
[Link]("Enter name to search: ");
String name = [Link]();
Long phno = [Link](name);
if(phno != null)
{
long no = [Link]();
[Link](name+" Phone No is: "+no);
}
else
[Link]("Name is not found.");
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
15. Program to create a Thread using Runnable interface.

class MyThread implements Runnable


{
int n;
MyThread(int n)
{
this.n = n;
}
public void run()
{
for(int i=1; i<=n; i++)
{
[Link](" Thread One "+i);
if(i%2 == 0)
[Link]("Even No from Thread Two"+(i*i));
else
[Link]("Odd No From Thread Three "+(i*i*i));

try
{
[Link](2000);
}
catch(InterruptedException ie)
{
[Link]();
}
}
}
}
class MyThreadExa
{
public static void main(String args[])
{
MyThread m1 = new MyThread(10);
MyThread m2 = new MyThread(10);
MyThread m3 = new MyThread(10);
Thread t1 = new Thread(m1);
Thread t2 = new Thread(m2);
Thread t3 = new Thread(m3);
[Link]();
[Link]();
[Link]();
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
16. Program for Inter Thread Communication and Synchronized method.

class Chat
{
boolean flag = false;
public synchronized void Question(String msg)
{
if (flag)
{
try
{
wait();
}
catch (InterruptedException e)
{
[Link]();
}
}
[Link](msg);
flag = true;
notify();
}
public synchronized void Answer(String msg)
{
if (!flag)
{
try
{
wait();
}
catch (InterruptedException e)
{
[Link]();
}
}
[Link](msg);
flag = false;
notify();
}
}
class T1 implements Runnable
{
Chat m;
String[] s1 = { "Hi", "How are you ?", "I am also doing fine!" };
public T1(Chat m1)
{
this.m = m1;
new Thread(this, "Question").start();
}
public void run()
{

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
for (int i = 0; i < [Link]; i++)
{
[Link](s1[i]);
}
}
}
class T2 implements Runnable
{
Chat m;
String[] s2 = { "Hi", "I am good, what about you?", "Great!" };

public T2(Chat m2)


{
this.m = m2;
new Thread(this, "Answer").start();
}

public void run()


{
for (int i = 0; i < [Link]; i++)
{
[Link](s2[i]);
}
}
}
public class ChatTest
{
public static void main(String[] args)
{
Chat m = new Chat();
new T1(m);
new T2(m);
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
17. Program to handle traffic signals using Window and Component events.

import [Link].*;
import [Link].*;
class TrafficSignal extends Frame implements ActionListener
{
Button b1, b2, b3;
TrafficSignal()
{
[Link](null);
b1 = new Button("Red");
b2 = new Button("Yellow");
b3 = new Button("Green");
[Link](100, 100, 70, 40);
[Link](100, 160, 70, 40);
[Link](100, 220, 70, 40);
[Link](b1);
[Link](b2);
[Link](b3);
[Link](this);
[Link](this);
[Link](this);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
[Link](0);
}
});
}
public void actionPerformed(ActionEvent ae)
{
Graphics g = [Link]();
String str = [Link]();
if([Link]() == b1)
[Link]("Stop", 250, 120);
if([Link]() == b2)
[Link]("Wait",250,180);
if([Link]() == b3)
[Link]("Go",250,240);
}
public static void main(String args[])
{
TrafficSignal tc = new TrafficSignal();
[Link]([Link]);
[Link](400, 400);
[Link]("Traffic Rules: ");
[Link](true);
}
}

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
18. Program to handle Mouse events.

import [Link].*;
import [Link].*;
public class MouseExample extends Frame implements MouseMotionListener
{
MouseExample()
{
addMouseMotionListener(this);
setSize(500,500);
setLayout(null);
setVisible(true);
}
public void mouseDragged(MouseEvent e)
{
Graphics g = getGraphics();
[Link]([Link]);
[Link]([Link](), [Link](), 5, 5);
}
public void mouseMoved(MouseEvent e)
{
Graphics g = getGraphics();
[Link]([Link]);
[Link]([Link](), [Link](), 5, 5);
}
public static void main(String[] args)
{
new MouseExample();
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
19. Program for MouseAdapter example.

import [Link].*;
import [Link].*;
public class MouseAdapterExample extends MouseAdapter
{
Frame f;
MouseAdapterExample()
{
f = new Frame("Mouse Adapter");
[Link](this);
[Link](300,300);
[Link](null);
[Link](true);
}
public void mouseEntered(MouseEvent e)
{
Graphics g = [Link]();
[Link]([Link]);
[Link]([Link](),[Link](),30,30);
}
public static void main(String[] args)
{
new MouseAdapterExample();
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
20. Program for creating and running an Applet.

import [Link].*;
import [Link].*;
public class AppletExample extends Applet
{
String str = "";
public void init()
{
setBackground([Link]);
setForeground([Link]);
Font f = new Font("Arial", [Link], 20);
setFont(f);
str += " Welcome ";
}
public void start()
{
str += " To ";
}
public void stop()
{
str += " Applets Program ";
}
public void destroy()
{
str += "Destroy";
}
}

/*<applet code="AppletExample" height=300 width=300>


</applet>*/

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
21. Program to create a mini calculator using AWT.

import [Link].*;
import [Link].*;
import [Link].*;

/*<applet code = "Calculator" width = 260 height = 310>


</applet>*/

public class Calculator extends Applet implements ActionListener


{
TextField t1;
Button b1, b2, b3, b4, b5, b6, b7, b8, b9, b0;
Button add, sub, mul, div, eql, dot;
String msg = "", tmp;
int a, b;
public void init()
{
setLayout(null);
t1 = new TextField(20);
b1 = new Button("1");
b2 = new Button("2");
b3 = new Button("3");
b4 = new Button("4");
b5 = new Button("5");
b6 = new Button("6");
b7 = new Button("7");
b8 = new Button("8");
b9 = new Button("9");
b0 = new Button("0");
add = new Button("+");
sub = new Button("-");
div = new Button("/");
mul = new Button("*");
dot = new Button(".");
eql = new Button("=");

add(t1);
add(b7);
add(b8);
add(b9);
add(div);

add(b4);
add(b5);
add(b6);
add(mul);

add(b1);
add(b2);
add(b3);

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
add(sub);

add(dot);
add(b0);
add(eql);
add(add);

[Link](30, 30, 200, 40);


[Link](30, 80, 44, 44);
[Link](82, 80, 44, 44);
[Link](134, 80, 44, 44);
[Link](30, 132, 44, 44);
[Link](82, 132, 44, 44);
[Link](134, 132, 44, 44);
[Link](30, 184, 44, 44);
[Link](82, 184, 44, 44);
[Link](134, 184, 44, 44);
[Link](30, 236, 44, 44);
[Link](82, 236, 44, 44);
[Link](134, 236, 44, 44);
[Link](186, 236, 44, 44);
[Link](186, 184, 44, 44);
[Link](186, 132, 44, 44);
[Link](186, 80, 44, 44);

[Link](this);
[Link](this);
[Link](this);
[Link](this);
[Link](this);
[Link](this);
[Link](this);
[Link](this);
[Link](this);
[Link](this);

[Link](this);
[Link](this);
[Link](this);
[Link](this);
[Link](this);
}
public void actionPerformed(ActionEvent ae)
{
String str = [Link]();
if ([Link]("+")||[Link]("-")||[Link]("*")||[Link]("/"))
{
String str1 = [Link]();
tmp = str;
a = [Link](str1);
msg = "";
}
B V Raju Institute of Technology Department of Computer Science and Engineering
Java Programming Page No:
else if([Link]("="))
{
String str2 = [Link]();
b = [Link](str2);
int res=0;
if(tmp == "+")
res = a + b;
else if(tmp == "-")
res = a - b;
else if(tmp == "*")
res = a * b;
else if(tmp == "/")
res = a / b;
String str1=[Link](res);
[Link](""+str1);
msg = "";
}
else
{
msg += str;
[Link](""+msg);
}
}
public void paint(Graphics g)
{
[Link]([Link]);
[Link](20,20,220,270);
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
22. Program to create a Menu and MenuItem using Swings.

import [Link].*;
class MenuExample
{
JMenu menu, submenu;
JMenuItem i1, i2, i3, i4, i5;
MenuExample()
{
JFrame f = new JFrame("Menu and MenuItem Example");
JMenuBar mb =new JMenuBar();
menu = new JMenu("Menu");
submenu = new JMenu("Sub Menu");
i1 = new JMenuItem("Item 1");
i2 = new JMenuItem("Item 2");
i3 = new JMenuItem("Item 3");
i4 = new JMenuItem("Item 4");
i5 = new JMenuItem("Item 5");
[Link](i1);
[Link](i2);
[Link](i3);

[Link](i4);
[Link](i5);

[Link](submenu);

[Link](menu);

[Link](mb);
[Link](400, 400);
[Link](null);
[Link](true);
}
public static void main(String args[])
{
new MenuExample();
}
}

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
23. JDBC program to store the data to Database.

import [Link].*;
class JDBCStoring
{
public static void main(String args[])
{
try
{
//step1 load the driver class
[Link]("[Link]");

//step2 create the connection object


Connection con =
[Link]("jdbc:oracle:thin:@localhost:1521:xe","system","tiger");

//step3 create the statement object


Statement stmt = [Link]();

//step4 execute query and handle the results


int x = [Link]("insert into student values(101, 'Ram', 77.66)");
if(x > 0)
[Link]("Date Inserted Successfully");
else
[Link]("Data insertion failed");
//step5 close the connection object
[Link]();

}//try
catch(Exception e)
{
[Link](e);
}//catch
}//main
}//JDBCStoring

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering


Java Programming Page No:
24. JDBC program to retrieve the data from Database.

import [Link].*;
class JDBCRetrieve
{
public static void main(String args[])
{
try
{
//step1 load the driver class
[Link]("[Link]");

//step2 create the connection object


Connection con =
[Link]("jdbc:oracle:thin:@localhost:1521:xe","system","tiger");

//step3 create the statement object


Statement stmt = [Link]();

//step4 execute query and handle the results


ResultSet rs = null;
rs = [Link]("select * from student");
[Link]("SID\tName\tAverage");
while([Link]())
{
[Link]([Link]("sid")+"\t"+[Link]("name")+"\t"+[Link]("avg"));
}

//step5 close the connection object


[Link]();

}//try
catch(Exception e)
{
[Link](e);
}//catch
}//main
}//JDBCRetrieve

Output:

B V Raju Institute of Technology Department of Computer Science and Engineering

You might also like