A feature of the operating system.
Programs can be written to use any type of file as input, but this chapter only discusses input with text files. Here is a program that reads input from the keyboard:
import java.util.Scanner; class Echo { public static void main ( String[] args ) { Scanner scan = new Scanner( System.in ); String line; System.out.println("Enter your input:"); line = scan.nextLine(); System.out.println( "You typed: " + line ); } }
Here is how the program ordinarily works:
C:\users\default\JavaLessons>java Echo Enter your input: This came from the keyboard You typed: This came from the keyboard D:\users\default\JavaLessons>
How many lines of data does the program read?