Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner scanner = new Scanner(System.in);
- if (scanner.hasNext()) {
- String value = scanner.nextLine();
- System.out.println(Identifier + value);
- } else if (scanner.hasNextInt()) {
- int intValue = scanner.nextInt();
- System.out.println(Identifier + intValue);
- } else if (scanner.hasNextDouble()) {
- double doubleValue = scanner.nextDouble();
- System.out.println(Identifier + doubleValue);
- }
Add Comment
Please, Sign In to add comment