FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java_sneha/ObjectInput.java at main · Snehatiwari2425/java_sneha · GitHub
Snehatiwari2425
/
java_sneha
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java_sneha
/
ObjectInput.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (22 loc) · 834 Bytes
Breadcrumbs
java_sneha
/
ObjectInput.java
Copy path
File metadata and controls
32 lines (22 loc) · 834 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package
Day2Task
;
import
java
.
io
.*;
public
class
ObjectInput
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// TODO Auto-generated method stub
//write data using objectoutputstream
int
data1
=
5
;
String
data2
=
"welcome"
;
FileOutputStream
fout
=
new
FileOutputStream
(
"C:
\\
Users
\\
sneha tiwari
\\
Desktop
\\
t1.txt"
);
ObjectOutputStream
oas
=
new
ObjectOutputStream
(
fout
);
oas
.
writeInt
(
data1
);
oas
.
writeObject
(
data2
);
//oas.writeObjet(new Date());
//read data using objectinputstream
FileInputStream
fin
=
new
FileInputStream
(
"C:
\\
Users
\\
sneha tiwari
\\
Desktop
\\
t1.txt"
);
ObjectInputStream
os
=
new
ObjectInputStream
(
fin
);
System
.
out
.
println
(
"integer data:"
+
os
.
readInt
());
System
.
out
.
println
(
"string data:"
+
os
.
readObject
());
oas
.
close
();
os
.
close
();
}
}
Back
|
FazBrowse Home
|
New Git URL