Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ScannerDemo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String s = scanner.nextLine();
- int i = scanner.nextInt();
- double d = scanner.nextDouble();
- // etc., get other things from scanner
- // make sure to close scanner when you are done with it
- // important: you cannot reopen the scanner again after you close it
- scanner.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement