Scanner Classclick here for complete presentation What is the Scanner Class?The Scanner class allows a program to read in data from the keyboard To use a the Scanner, follow these steps
Exampleimport java.util.Scanner; public class ScannerExample public static void main (String [] args) Scanner myScanObj = new Scanner(System.in); System.out.println("Enter a sentence:"); System.out.println("Enter an integer:"); System.out.println("Enter a double:"); System.out.println("Your sentence:\n" + sentence); |
Scanner Class |
|