Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
4 views
C
C
Uploaded by
IRON MAN
AI-enhanced title
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
Download now
Download
Save c For Later
Download
Save
Save c For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
4 views
C
C
Uploaded by
IRON MAN
AI-enhanced title
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
Download now
Download
Save c For Later
Carousel Previous
Carousel Next
Download
Save
Save c For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 2
Search
Fullscreen
Number:"); lbl2.setBounds(20, 50, 100, 10); name='Hari',address='Ktm' WHERE sid='1'"; import java.io.
*; public class MyTest {
jframe.add(lbl2); JTextField txt2=new JTextField(); st.execute(sql2); System.out.println("\nData public static void main(String[] args) {
txt2.setBounds(120, 50, 120, 20); jframe.add(txt2); Updated Successfully"); try { FileWriter writer = new
JLabel lbl3=new JLabel("Result: "); FileWriter("MyFile.txt", true);
//lbl3.setText("Result: "); //deleting data String sql3="DELETE FROM student writer.write("Hello World");
WHERE sid='2'"; st.execute(sql3); writer.write("\r\n"); // write new line
lbl3.setBounds(20,80,100,30); jframe.add(lbl3); System.out.println("Data Deleted Successfully\n"); writer.write("Good Bye!");
JButton btn=new JButton("Calculate"); //retrieving data System.out.println("Data After writer.close(); } catch (IOException e) {
btn.setBounds(100, 120, 100, 30); Update and Delete"); String sql5="SELECT * FROM e.printStackTrace(); } } }
jframe.add(btn); btn.addActionListener(new student"; ResultSet rs1=st.executeQuery(sql5); Serialization Interface Serializable is a
ActionListener() { public void System.out.println("Sid\t"+"Name\t"+"address\t" marker interface (has no data member
actionPerformed(ActionEvent ae) { String +"Contact"); while(rs1.next()) { String and method). It is used to "mark" Java
first1=txt1.getText().toString(); String sid=rs1.getString(1); String name=rs1.getString(2); classes so that objects of these classes
second1=txt2.getText().toString(); int a,b,c; String address=rs1.getString(3); String may get the certain capability. The
a=Integer.parseInt(first1); contact=rs1.getString(4); Cloneable and Remote are also marker
b=Integer.parseInt(second1); c=a+b; System.out.println(sid+"\t"+name+"\t"+address+" interfaces.
lbl3.setText("Result: "+c); \t"+contact); } }catch(Exception e) { Serialization Example import java.io.*;
//JOptionPane.showMessageDialog(null, System.out.println(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
SwingUtilities.invokeLater(new Runnable() { public import java.applet.*; import java.awt.*; import
r, String c) { this.name = n; this.rid = r;
void run() { new SwingDemo(); } }); } } java.awt.event.*; public class Applet2 extends
impot java.swing.*; this.contact = c; } } public class MyTest {
Applet { public void init() { Label lbl1=new
public static void main(String[] args) {
import java.sql.*; public class DB_Test { public Label("First Number: "); add(lbl1); TextField
import java.awt.event.*; 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 Class.forName("com.mysql.jdbc.Driver"); Label("Second Number: "); add(lbl2); TextField
FileOutputStream fos = new
implements KeyListener{ Label l; TextArea area; Connection conn=DriverManager.getConnection txt2=new TextField(10);
FileOutputStream("student.ser");
KeyListenerExample(){ l=new Label(); ("jdbc:mysql://localhost:3306/bca","root","");
add(txt2); Label lbl3=new Label("Result: "); ObjectOutputStream oos = new
l.setBounds(20,50,100,20); area=new TextArea(); //database="", username=root and password=""
add(lbl3); Button btn=new Button("Submit"); ObjectOutputStream(fos);
area.setBounds(20,80,300, 300); System.out.println("Database connected");
add(btn); btn.addActionListener(new oos.writeObject(si); oos.close();
area.addKeyListener(this); add(l);add(area); Statement st=conn.createStatement(); //clearing
ActionListener() { public void fos.close(); } catch (Exception e) {
setSize(400,400); setLayout(null); setVisible(true); data String sql="DELETE FROM student";
actionPerformed(ActionEvent ae) { int e.printStackTrace(); } } } Object of
} public void keyPressed(KeyEvent e) { st.execute(sql); //inserting data String
first=Integer.parseInt (txt1.getText().toString()); int Studentinfo class is serialized using
l.setText("Key Pressed"); } public void sql1="INSERT INTO
second=Integer.parseInt (txt2.getText().toString()); writeObject() method and written to
keyReleased(KeyEvent e) { l.setText("Key student(sid,name,address,contact) VALUES
int res=first+second; lbl3.setText("Result: "+res); } student.ser file. Deserialization
Released"); } public void keyTyped(KeyEvent e) { ('1','Raaju','Btm','9862612723'),
}); } } Example import java.io * ; class
l.setText("Key Typed"); } public static void ('2','Ram','Ktm','8811111111')"; st.execute(sql1);
DeserializationTest { public static void
main(String[] args) { new KeyListenerExample(); } } System.out.println("Data Inserted
1. Reading a File import java.io.*; public main(String[] args) { studentinfo si=null
Successfully\n"); //retrieving data
class MyTest { public static void ; try { FileInputStream fis = new
import javax.swing.*; import java.awt.event.*; System.out.println("Data Before Update and
main(String[] args) { try { FileReader FileInputStream("student.ser");
public class SwingDemo { SwingDemo(){ JFrame Delete"); String sql4="SELECT * FROM student";
reader = new FileReader("MyFile.txt"); ObjectOutputStream ois = new
jframe=new JFrame("This is a simple JFrame ResultSet rs=st.executeQuery(sql4);
BufferedReader bufferedReader = new ObjectOutputStream(fis); si =
App"); jframe.setSize(400, 300); System.out.println("Sid\t"+"Name\t"+"address\t"
BufferedReader(reader); String line; (studentinfo)ois.readObject(); }
jframe.setLocationRelativeTo(null); +"Contact"); while(rs.next()) { String
while ((line = catch (Exception e) {
jframe.getContentPane().setLayout(null); sid=rs.getString(1); String name=rs.getString(2);
bufferedReader.readLine()) != null) { e.printStackTrace(); }
jframe.setVisible(true); JLabel lbl1=new String address=rs.getString(3); String
System.out.println(line); } System.out.println(si.name);
JLabel("First Number:"); lbl1.setBounds(20, 10, contact=rs.getString(4);
reader.close(); } catch (IOException e) { System.out. println(si.rid);
100, 10); jframe.add(lbl1); JTextField txt1=new System.out.println(sid+"\t"+name+"\t"+address+"
e.printStackTrace(); } } } System.out.println(si.contact); } }
JTextField(); txt1.setBounds(120, 10, 120, 20); \t"+contact); } //updating data String
2. . Writing to a File
jframe.add(txt1); JLabel lbl2=new JLabel("Second sql2="UPDATE student SET
You might also like
Service Manual 2702
PDF
67% (3)
Service Manual 2702
915 pages
STM 32
PDF
100% (2)
STM 32
4 pages
Queue Program in C
PDF
No ratings yet
Queue Program in C
3 pages
SP C260, C262 Service Manual
PDF
No ratings yet
SP C260, C262 Service Manual
252 pages
QCC300x I S: User Guide
PDF
100% (1)
QCC300x I S: User Guide
27 pages
Java Cie 2
PDF
No ratings yet
Java Cie 2
11 pages
java pgms
PDF
No ratings yet
java pgms
8 pages
java
PDF
No ratings yet
java
14 pages
Record Programs
PDF
No ratings yet
Record Programs
26 pages
Java Lab
PDF
No ratings yet
Java Lab
33 pages
Practical Record Java 2021
PDF
No ratings yet
Practical Record Java 2021
42 pages
Coding Interview On Database
PDF
No ratings yet
Coding Interview On Database
32 pages
Practical Exam
PDF
No ratings yet
Practical Exam
13 pages
Iind Cycle Java Lab Program
PDF
No ratings yet
Iind Cycle Java Lab Program
8 pages
AJP Lab
PDF
No ratings yet
AJP Lab
34 pages
Database - JDBC (Java - SQL) Connecting To A Database: Mydatabase
PDF
No ratings yet
Database - JDBC (Java - SQL) Connecting To A Database: Mydatabase
37 pages
Prac Pgms
PDF
No ratings yet
Prac Pgms
21 pages
Core Java 1
PDF
No ratings yet
Core Java 1
13 pages
Tasks For Final Project
PDF
No ratings yet
Tasks For Final Project
6 pages
Programs
PDF
No ratings yet
Programs
70 pages
Java ASSIGNMENT
PDF
No ratings yet
Java ASSIGNMENT
17 pages
Ctood Ha
PDF
No ratings yet
Ctood Ha
16 pages
Programas Java
PDF
No ratings yet
Programas Java
16 pages
Enhanced Student Management System JDBC API Documentation
PDF
No ratings yet
Enhanced Student Management System JDBC API Documentation
19 pages
Adv Java
PDF
No ratings yet
Adv Java
26 pages
fiza oop 2
PDF
No ratings yet
fiza oop 2
17 pages
JavaScript Practical
PDF
No ratings yet
JavaScript Practical
53 pages
Library Management System in Java
PDF
No ratings yet
Library Management System in Java
59 pages
Ajp 7-10
PDF
No ratings yet
Ajp 7-10
13 pages
p3java
PDF
No ratings yet
p3java
11 pages
Document from ✨...?
PDF
No ratings yet
Document from ✨...?
47 pages
Java Lab Codings
PDF
No ratings yet
Java Lab Codings
15 pages
Assignment Java
PDF
No ratings yet
Assignment Java
18 pages
OOPsheet
PDF
No ratings yet
OOPsheet
14 pages
Music BGM
PDF
No ratings yet
Music BGM
39 pages
LAB MANUAL OOP
PDF
No ratings yet
LAB MANUAL OOP
31 pages
1.collection Using Set, List and Map Interfaces
PDF
No ratings yet
1.collection Using Set, List and Map Interfaces
25 pages
correct
PDF
No ratings yet
correct
33 pages
Assignment of Advanced Programming
PDF
No ratings yet
Assignment of Advanced Programming
15 pages
java apr2023 pdf
PDF
No ratings yet
java apr2023 pdf
9 pages
Key-Test-1 18SC2009 Object Oriented Programming
PDF
No ratings yet
Key-Test-1 18SC2009 Object Oriented Programming
25 pages
All Java Pratical
PDF
No ratings yet
All Java Pratical
16 pages
JAVAP
PDF
No ratings yet
JAVAP
48 pages
School of Computing Science: Practical Record
PDF
100% (1)
School of Computing Science: Practical Record
42 pages
Q1.What Is Java? Why It Is Needed?
PDF
No ratings yet
Q1.What Is Java? Why It Is Needed?
33 pages
JDBC Questions and Answers
PDF
No ratings yet
JDBC Questions and Answers
18 pages
viva answers
PDF
No ratings yet
viva answers
14 pages
1
PDF
No ratings yet
1
52 pages
Object Oriented Software Concepts and Development PRACTICAL ASSIGNMENT N0236685B
PDF
No ratings yet
Object Oriented Software Concepts and Development PRACTICAL ASSIGNMENT N0236685B
10 pages
Java Sample Program
PDF
No ratings yet
Java Sample Program
18 pages
Librarymaagement
PDF
No ratings yet
Librarymaagement
7 pages
Java Lab Answer 5
PDF
No ratings yet
Java Lab Answer 5
8 pages
java-lab report
PDF
No ratings yet
java-lab report
39 pages
JDBC and others
PDF
No ratings yet
JDBC and others
8 pages
Java P110
PDF
No ratings yet
Java P110
14 pages
Java Lab Problem MCA
PDF
No ratings yet
Java Lab Problem MCA
58 pages
Core Java Material 2
PDF
No ratings yet
Core Java Material 2
199 pages
Java
PDF
No ratings yet
Java
5 pages
New Microsoft Office Power Point Presentation
PDF
No ratings yet
New Microsoft Office Power Point Presentation
73 pages
Java Exam Notes
PDF
No ratings yet
Java Exam Notes
18 pages
Ajava Lab File (Priyathik Raj)
PDF
No ratings yet
Ajava Lab File (Priyathik Raj)
35 pages
CSE-12-batch-question-solve-1
PDF
No ratings yet
CSE-12-batch-question-solve-1
11 pages
Lab Sheet - Module 1 - Record - Writing
PDF
No ratings yet
Lab Sheet - Module 1 - Record - Writing
9 pages
Javascript Assessment Test
From Everand
Javascript Assessment Test
Edward Yao
No ratings yet
Oracle Certified Professional Java Programmer OCPJP 1Z0 809
From Everand
Oracle Certified Professional Java Programmer OCPJP 1Z0 809
Manish Soni
No ratings yet
Hitachi_Advanced_Server_DS120_DS220_G2_BMC_Release Notes_RN-97HAS023-03
PDF
No ratings yet
Hitachi_Advanced_Server_DS120_DS220_G2_BMC_Release Notes_RN-97HAS023-03
52 pages
User Guide Nokia 106 User Guide
PDF
No ratings yet
User Guide Nokia 106 User Guide
25 pages
Important Questions in CF&P-1
PDF
No ratings yet
Important Questions in CF&P-1
14 pages
KnockoutJS Starter 1st New edition Edition Eric M. Barnard instant download
PDF
100% (1)
KnockoutJS Starter 1st New edition Edition Eric M. Barnard instant download
54 pages
ProModel Extended Features
PDF
No ratings yet
ProModel Extended Features
62 pages
Frequently Asked Questions About T-Engine Development Kit
PDF
No ratings yet
Frequently Asked Questions About T-Engine Development Kit
4 pages
Pretty Aesthetic Notes For School - by Slidesgo
PDF
No ratings yet
Pretty Aesthetic Notes For School - by Slidesgo
56 pages
Modify The Mouse Settings From The Command Line - Ghacks Tech News
PDF
No ratings yet
Modify The Mouse Settings From The Command Line - Ghacks Tech News
4 pages
Pricelist SINAU JOGJA
PDF
No ratings yet
Pricelist SINAU JOGJA
5 pages
Removed
PDF
No ratings yet
Removed
105 pages
API Management
PDF
No ratings yet
API Management
13 pages
Snowflake Dashboard - Credit Usage by User - by Caleb H. - Medium
PDF
No ratings yet
Snowflake Dashboard - Credit Usage by User - by Caleb H. - Medium
23 pages
Sai Plantation Consent Letter.
PDF
No ratings yet
Sai Plantation Consent Letter.
2 pages
3BUS095533 A4 HR en Symphony Plus - S I O HAI805 and HAO805 HART I O
PDF
No ratings yet
3BUS095533 A4 HR en Symphony Plus - S I O HAI805 and HAO805 HART I O
4 pages
Group 4 Review 1-1
PDF
No ratings yet
Group 4 Review 1-1
14 pages
Planning Engineers Interview Questions
PDF
100% (2)
Planning Engineers Interview Questions
42 pages
Interfacing of Analog To Digital Converter
PDF
No ratings yet
Interfacing of Analog To Digital Converter
2 pages
Groups and Problem Statements - IBM Summer Internship
PDF
No ratings yet
Groups and Problem Statements - IBM Summer Internship
33 pages
SDHSH 4333
PDF
No ratings yet
SDHSH 4333
40 pages
NET Architecture
PDF
No ratings yet
NET Architecture
13 pages
Database Quiz
PDF
No ratings yet
Database Quiz
4 pages
MLA Template
PDF
No ratings yet
MLA Template
3 pages
Manufacturing Deck
PDF
No ratings yet
Manufacturing Deck
20 pages
Assignment # 01 (ICT)
PDF
No ratings yet
Assignment # 01 (ICT)
8 pages
Ece5745 Overview
PDF
No ratings yet
Ece5745 Overview
59 pages