Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.io.*;
- public class Main {
- static boolean fut;
- static ArrayList<Sor> array = new ArrayList<Sor>();
- public static void main(String[] args) throws Throwable{
- fut=true;
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- String idg[] = null;
- while (fut){
- String line = reader.readLine();
- idg = line.split(" ");
- if (idg[0].equals("add")){
- Sor kek = new Sor(idg[1],idg[2],Double.parseDouble(idg[3]));
- array.add(kek);
- }
- if (idg[0].equals("list")){
- for(Sor i : array)
- System.out.println(i.name + " " + i.strength + " " + i.style);
- }
- }
- }
- public void load() throws Exception{
- File f = new File("Sorok.txt");
- FileOutputStream ka = new FileOutputStream(f);
- ObjectOutputStream ki = new ObjectOutputStream(ka);
- ki.writeObject(array);
- ki.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement