This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class Main { | |
public static void main(String[] args) { | |
A a = new A(4); | |
try (OutputStream os = new FileOutputStream("a"); | |
ObjectOutputStream oos = new ObjectOutputStream(os)) { | |
oos.writeObject(a); | |
os.write("hello".getBytes()); | |
} catch (IOException e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Country { | |
private String name; | |
private int sum; | |
private HashSet<Integer> users = new HashSet<>(); | |
public Country(Record record) { | |
name = record.getCountry(); | |
sum = record.getCount(); | |
users.add(record.getId()); | |
} |