okay so I know this code isn't entirely orthodox, but regardless it compiles & runs. the problem is once i input a txt file via the command line it only converts the first line in the file into String text. (yes, i know im using the nextLine() method.that is temp until i find a better way). How can i get the entire txt file, that has line breaks, into one string? thanks in advance for any suggestions/ tips.
    import java.util.*;
    public class Concordance{
    static Scanner kb;
    public static void main(String arg[]){
        //input text file, create array, create List, and call other methods
        kb = new Scanner(System.in);
        String text = kb.nextLine();
        String[] words = text.replaceAll("[^a-zA-Z ]", "").toLowerCase().split("\\s+");
        List<String> list = Arrays.asList(text.replaceAll("[^a-zA-Z ]", "").toLowerCase().split("\\s+"));
        System.out.println("number of words in text (including duplicates) is: " + words.length);
        System.out.println("");
        alphaPrint(list);
        System.out.println("");
        uniqueWord(list);
    }//end main
    //prints text in alphabetical order and counts unique words 
    public static void alphaPrint(List<String> list){
        int count = 0;
        TreeSet<String> uniqueWord = new TreeSet<String>(list);
        System.out.println("text in alphabetical order: ");
        Collections.sort(list);
        for (String word : uniqueWord) {
            System.out.println(word);
            count++;
        }
        System.out.println("");
        System.out.println("unique word count is: " + count);
    }//end alphaprint
    //method will find and print frequency counts
    public static void uniqueWord(List<String> list){
        System.out.println("text with word frequencies: ");
        TreeSet<String> uniqueWord = new TreeSet<String>(list);
        for (String word : uniqueWord) {
            System.out.println(word + ": " + Collections.frequency(list, word));
        }
    }//end unique word
}//end class
 
     
     
    