Datasets:
ArXiv:
License:
Stack-Repo / data /train /akash-coded /FSD_Java /Lesson-3 /Serializarion and Deserialization /Examples /SerializationDemo.java
Download data/train/akash-coded/FSD_Java/Lesson-3/Serializarion and Deserialization/Examples/SerializationDemo.java from RepoFusion/Stack-Repo: direct link, hf CLI and curl.
- Browser
- Download file 640 Bytes
-
https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Serializarion%20and%20Deserialization/Examples/SerializationDemo.java
- Command line
-
hf download 'hf://datasets/RepoFusion/Stack-Repo@bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Serializarion and Deserialization/Examples/SerializationDemo.java'
-
curl -L -o SerializationDemo.java https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Serializarion%20and%20Deserialization/Examples/SerializationDemo.java
640 Bytes
| import java.io.*; | |
| class StudentSeriliazation { | |
| public static void main(String... args) { | |
| try (FileOutputStream fout = new FileOutputStream("f.txt"); | |
| ObjectOutputStream out = new ObjectOutputStream(fout);) { | |
| // Creating the object | |
| Student s1 = new Student(21, "Akash"); | |
| // Write the object into the file | |
| out.writeObject(s1); | |
| // Flush the output stream pipe | |
| out.flush(); | |
| System.out.println("success"); | |
| } catch (Exception e) { | |
| System.out.println("failure"); | |
| System.out.println(e); | |
| } | |
| } | |
| } |