how do i read in files from a ".txt" file into a linked list

heres my code.

import java.io.*;
    public class LinkedList1
   {
   
       class Node
      {
         String element;	// list element
         Node next; 			// successor link
      
          Node(String el, Node n)
         {
            element = el;
            next = n;
         }
      
          Node(String el)
         {
            element = el;
            next = null;
         }
      
      }
   
       public static main (String[] args)
      {
         Node myList = new Node("1");
      // AT THIS PART OF MY CODE I WANT TO READ IN INTEGERS  FROM A ".txt" FILE
      // USING FILE IO HOW DO I DO THAT?
      }
   }

Use a Scanner. Really, the exact way to do it depends on how your text file is set up, but here is a general tutorial on Scanner.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.