Number:"); [Link](20, 50, 100, 10); name='Hari',address='Ktm' WHERE sid='1'"; import [Link].
*; public class MyTest {
[Link](lbl2); JTextField txt2=new JTextField(); [Link](sql2); [Link]("\nData public static void main(String[] args) {
[Link](120, 50, 120, 20); [Link](txt2); Updated Successfully"); try { FileWriter writer = new
JLabel lbl3=new JLabel("Result: "); FileWriter("[Link]", true);
//[Link]("Result: "); //deleting data String sql3="DELETE FROM student [Link]("Hello World");
WHERE sid='2'"; [Link](sql3); [Link]("\r\n"); // write new line
[Link](20,80,100,30); [Link](lbl3); [Link]("Data Deleted Successfully\n"); [Link]("Good Bye!");
JButton btn=new JButton("Calculate"); //retrieving data [Link]("Data After [Link](); } catch (IOException e) {
[Link](100, 120, 100, 30); Update and Delete"); String sql5="SELECT * FROM [Link](); } } }
[Link](btn); [Link](new student"; ResultSet rs1=[Link](sql5); Serialization Interface Serializable is a
ActionListener() { public void [Link]("Sid\t"+"Name\t"+"address\t" marker interface (has no data member
actionPerformed(ActionEvent ae) { String +"Contact"); while([Link]()) { String and method). It is used to "mark" Java
first1=[Link]().toString(); String sid=[Link](1); String name=[Link](2); classes so that objects of these classes
second1=[Link]().toString(); int a,b,c; String address=[Link](3); String may get the certain capability. The
a=[Link](first1); contact=[Link](4); Cloneable and Remote are also marker
b=[Link](second1); c=a+b; [Link](sid+"\t"+name+"\t"+address+" interfaces.
[Link]("Result: "+c); \t"+contact); } }catch(Exception e) { Serialization Example import [Link].*;
//[Link](null, [Link](e); } } } class Studentinfo implements
"Addition= "+c); } }); } public static void Serializable { String name; int rid; static
main(String[] args) { Example Program – Program to add two Numbers
String contact; Studentinfo(String n, int
[Link](new Runnable() { public import [Link].*; import [Link].*; import
r, String c) { [Link] = n; [Link] = r;
void run() { new SwingDemo(); } }); } } [Link].*; public class Applet2 extends
impot [Link].*; [Link] = c; } } public class MyTest {
Applet { public void init() { Label lbl1=new
public static void main(String[] args) {
import [Link].*; public class DB_Test { public Label("First Number: "); add(lbl1); TextField
import [Link].*; try { Studentinfo si = new
static void main(String[] args) { try { txt1=new TextField(10); add(txt1); Label lbl2=new
Studentinfo("Abhi", 104, "110044");
public class KeyListenerExample extends Frame [Link]("[Link]"); Label("Second Number: "); add(lbl2); TextField
FileOutputStream fos = new
implements KeyListener{ Label l; TextArea area; Connection conn=[Link] txt2=new TextField(10);
FileOutputStream("[Link]");
KeyListenerExample(){ l=new Label(); ("jdbc:mysql://localhost:3306/bca","root","");
add(txt2); Label lbl3=new Label("Result: "); ObjectOutputStream oos = new
[Link](20,50,100,20); area=new TextArea(); //database="", username=root and password=""
add(lbl3); Button btn=new Button("Submit"); ObjectOutputStream(fos);
[Link](20,80,300, 300); [Link]("Database connected");
add(btn); [Link](new [Link](si); [Link]();
[Link](this); add(l);add(area); Statement st=[Link](); //clearing
ActionListener() { public void [Link](); } catch (Exception e) {
setSize(400,400); setLayout(null); setVisible(true); data String sql="DELETE FROM student";
actionPerformed(ActionEvent ae) { int [Link](); } } } Object of
} public void keyPressed(KeyEvent e) { [Link](sql); //inserting data String
first=[Link] ([Link]().toString()); int Studentinfo class is serialized using
[Link]("Key Pressed"); } public void sql1="INSERT INTO
second=[Link] ([Link]().toString()); writeObject() method and written to
keyReleased(KeyEvent e) { [Link]("Key student(sid,name,address,contact) VALUES
int res=first+second; [Link]("Result: "+res); } [Link] file. Deserialization
Released"); } public void keyTyped(KeyEvent e) { ('1','Raaju','Btm','9862612723'),
}); } } Example import [Link] * ; class
[Link]("Key Typed"); } public static void ('2','Ram','Ktm','8811111111')"; [Link](sql1);
DeserializationTest { public static void
main(String[] args) { new KeyListenerExample(); } } [Link]("Data Inserted
1. Reading a File import [Link].*; public main(String[] args) { studentinfo si=null
Successfully\n"); //retrieving data
class MyTest { public static void ; try { FileInputStream fis = new
import [Link].*; import [Link].*; [Link]("Data Before Update and
main(String[] args) { try { FileReader FileInputStream("[Link]");
public class SwingDemo { SwingDemo(){ JFrame Delete"); String sql4="SELECT * FROM student";
reader = new FileReader("[Link]"); ObjectOutputStream ois = new
jframe=new JFrame("This is a simple JFrame ResultSet rs=[Link](sql4);
BufferedReader bufferedReader = new ObjectOutputStream(fis); si =
App"); [Link](400, 300); [Link]("Sid\t"+"Name\t"+"address\t"
BufferedReader(reader); String line; (studentinfo)[Link](); }
[Link](null); +"Contact"); while([Link]()) { String
while ((line = catch (Exception e) {
[Link]().setLayout(null); sid=[Link](1); String name=[Link](2);
[Link]()) != null) { [Link](); }
[Link](true); JLabel lbl1=new String address=[Link](3); String
[Link](line); } [Link]([Link]);
JLabel("First Number:"); [Link](20, 10, contact=[Link](4);
[Link](); } catch (IOException e) { [Link]. println([Link]);
100, 10); [Link](lbl1); JTextField txt1=new [Link](sid+"\t"+name+"\t"+address+"
[Link](); } } } [Link]([Link]); } }
JTextField(); [Link](120, 10, 120, 20); \t"+contact); } //updating data String
2. . Writing to a File
[Link](txt1); JLabel lbl2=new JLabel("Second sql2="UPDATE student SET