Start New Discussion within our Software Development Community

I can get it to save then load but it does it at the same time and not seperatly

public void Load()
   {
      try
      {
         System.out.println("Where would you like to Load from?");

         BufferedReader reader = new BufferedReader(new FileReader(Input.next()));

         String line;    
         int count = 0;   
         list = new doublyLinkedList();

         while ((line = reader.readLine()) != null)
         {   
            System.out.println(line + "\n");
            list.addNode(line);
            count++;
         }

         reader.close();        
      } catch (FileNotFoundException e1)
      {
         e1.printStackTrace();
      } catch (IOException x)
      {
         x.printStackTrace();
      }
   }

   public void Save()
   {

      String Value;
      doubleNode Temp;
      Temp = list.getBegin();

      int k = 0;
      String [] lis = {"","","","","","","","","","","","","","","","","","","",""};

      while( (Value = Temp.getValue()) != null)
      {

         lis [k] = Value;
         Temp = Temp.getNext();
         k++;
         if(Temp == null)
            break;
      }

      try
      {

         System.out.println("Where would you like to Save?");

         PrintWriter writer = new PrintWriter(new FileOutputStream(Input.next()));

         int i = 0;
         {
         do
         {
            writer.write(lis[i]);
            i++;
         }
         while(i < 20);
         }
         writer.flush();
         writer.close();
      }
      catch (Exception e1)    
      {
         e1.printStackTrace();
      }
   }
This article has been dead for over six months. Start a new discussion instead.