A)
Write a JDBC program to delete the details of given employee (ENo EName
Salary).
Accept employee ID through command line.
Answer :
Output :
B) Write a java program in multithreading using applet for drawing temple.
Answer :
import java.awt.*;
public class Slip20B extends Frame {
int f = 0;
public Slip20B() {
Signal s = new Signal();
s.start();
setSize(500, 500);
setVisible(true);
}
public void paint(Graphics g) {
switch (f) {
case 0:
g.drawRect(100, 150, 90, 120);
case 1:
g.drawRect(130, 230, 20, 40);
case 2:
g.drawLine(150, 100, 100, 150);
case 3:
g.drawLine(150, 100, 190, 150);
case 4:
g.drawLine(150, 50, 150, 100);
case 5:
g.drawRect(150, 50, 20, 20);
}
}
class Signal extends Thread {
public void run() {
while (true) {
f = (f + 1) % 5;
repaint();
try {
Thread.sleep(1000);
} catch (Exception e) {
}
}
}
}
public static void main(String args[]) {
new Slip20B();
}
}

No comments:
Post a Comment