Advertisement
makispaiktis

Input in java

Feb 10th, 2019 (edited)
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. Scanner reader = new Scanner(System.in);  // Reading from System.in
  4. System.out.println("Enter a number: ");
  5. int n = reader.nextInt(); // Scans the next token of the input as an int.
  6. //once finished
  7. reader.close();
  8.  
  9. ή
  10.  
  11. import java.util.Scanner;
  12. Scanner scan = new Scanner(System.in);
  13. String s = scan.next();
  14. int i = scan.nextInt();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement