Advertisement
Guest User

Untitled

a guest
Sep 24th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.io.*;
  3. public class Main {
  4. static boolean fut;
  5. static ArrayList<Sor> array = new ArrayList<Sor>();
  6. public static void main(String[] args) throws Throwable{
  7. fut=true;
  8. BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  9. String idg[] = null;
  10. while (fut){
  11.  
  12. String line = reader.readLine();
  13. idg = line.split(" ");
  14. if (idg[0].equals("add")){
  15. Sor kek = new Sor(idg[1],idg[2],Double.parseDouble(idg[3]));
  16. array.add(kek);
  17. }
  18. if (idg[0].equals("list")){
  19. for(Sor i : array)
  20. System.out.println(i.name + " " + i.strength + " " + i.style);
  21. }
  22.  
  23. }
  24. }
  25.  
  26.  
  27. public void load() throws Exception{
  28. File f = new File("Sorok.txt");
  29. FileOutputStream ka = new FileOutputStream(f);
  30. ObjectOutputStream ki = new ObjectOutputStream(ka);
  31. ki.writeObject(array);
  32. ki.close();
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement