A. Asaadi
6
Q:

how to use scanners in java

import java.util.Scanner;

Public class Scanner {
	Public static void main(String[] args) {
    	// Scanner *scanner name here* = new Scanner(System.in);
      	Scanner scan = new Scanner(System.in);
      	System.out.println("Type anything and the scanner will take that input and print it");
      	String next = scan.next();
      	System.out.println(next);
    } 
}
3
import java.util.scanner;

Scanner *scanner name* = new Scanner(*input source*);

// Examples:
Scanner user = new Scanner(system.in);
Scanner text = new Scanner(new File("text.txt"));
11
import java.util.Scanner;
4

New to Communities?

Join the community