// // EOF-ctrl loop // Goal: count the # of words in the file data.txt? // out the words in a row // import java.util.Scanner; class Out_CountWords { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = 0; // setup the counter String data = " "; // used to hold data while ( input.hasNext() ) { data = input.next(); count ++; //System.out.print(data + " "); } System.out.println("\n\nsize = " + count + "\n\n"); } }