How reading from text file into stack and queues using doubly linked list in java
<p>I explain my program. This program have two files and two files have student no, student name and surname. </p>

<ul>
<li><p>Example:</p></li>
<li><p>queues.txt : </p></li>
<li>Student_No#Name#Surname </li>
<li>1234#Jane#Weber#       </li>
<li>1235#Johnson#Roy    </li>
<li>1267#Henry#Morin    </li>
<li>stack.txt:   </li>
<li>Student_No#Name#Surname       </li>
<li>3456#Jane#lee            </li>
<li>7535#Johnson#Perez    </li>
<li>1967#Henry#Fortin</li>
</ul>

<p>How do I read and  throw stack and queue? 
Program has Data class , Node class , Stack class , Queue Class and Main Class. 
I did every class except main class because I cant read file after throw stack and queue.</p>

<pre><code>   public static void main(String[] args) throws IOException {

    Stack stack = new Stack(); 
    Queues queue = new Queues();

    File stackfile = new File("stack.txt"); 


    if (!stackfile.exists()) { 
        stackfile.createNewFile(); 
    } else {
        System.out.println("File is done"); 
    }
    FileReader r= new FileReader(stackfile);
    BufferedReader reader = new BufferedReader(r); 

    String line = null; 
    Data data= new Data(); // this class have String name, surname and string number

    int i=1;
    while ((line=reader.readLine())!=null) { 

        { if(line.trim().equals("#")){
            stack.Push(data);
            data=new Data();
            i=1;
        }
        else{
            if(i==1){
                data.setNo(line);
            }
            else if(i==2){
                data.setName(line);

            }
            else if(i==3){
                data.setSurName(line);
            }
            i++;

            }
        }





    }
    stack.Push(data);
    reader.close();

    File queuefile = new File("queue.txt"); 

    if (!queuefile.exists()) { 
        queuefile.createNewFile(); 
    } else {
        System.out.println("File is done");
    }

    BufferedReader read = null; 
    read = new BufferedReader(new FileReader(queuefile));
    String lines = read.readLine();


    while (lines != null) { 
        System.out.println("Read from queue: " + lines);


         { if(lines.trim().equals("#")){
            queue.insert(data);
            data=new Data();
            i=1;
        }
        else{
            if(i==1){
                data.setNo(line);
            }
            else if(i==2){
                data.setName(line);

            }
            else if(i==3){
                data.setSurName(line);
            }
            i++;

            }
        }


    }
    queue.insert(data);
    read.close();

   }
  }
</code></pre>