Guest User

Untitled

a guest
Mar 24th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. Scanner scanner = new Scanner(System.in);
  2.  
  3. if (scanner.hasNext()) {
  4. String value = scanner.nextLine();
  5. System.out.println(Identifier + value);
  6. } else if (scanner.hasNextInt()) {
  7. int intValue = scanner.nextInt();
  8. System.out.println(Identifier + intValue);
  9. } else if (scanner.hasNextDouble()) {
  10. double doubleValue = scanner.nextDouble();
  11. System.out.println(Identifier + doubleValue);
  12. }
Add Comment
Please, Sign In to add comment