Don't use a line-beased input after a token-based input.
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter an integer: ");
int value = input.nextInt();
System.out.println("The value is " + value);
System.out.print("Enter a line: ");
String line = input.nextLine();
System.out.println("The line is " + line);
}
}
Enter a phone word: warbler
The number is 9272537.
Enter a phone word: GOOD4U2
The number is 4663482.
Enter a phone word: OMG
Your phone word is not long enough for a phone number.
Enter a phone word: GREAT DEALS
The number is 4732833.
Also in Java:
- how to get length of integer in java
- Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification
- fibonacci sequence in java recursion
- how to scan a character in java
- read lines of file randomly java
- get raondom from array java
- java regex replace all characters before
- Enums injava
- when super add by constructor in java
- java 8 iterating and manipulating list
- remove item from arraylist in java
- java check if directory exists
- java
- list java oracle
- java 8 list stream delete by name
- how to set a windows background image tkinter
- connect 2 package in android
- how to detect if someone clicks on a jpanel in java
- how to remove all whitespace from string java
- how to create a circle in java
- java check if args is empty
- how to declare array java
- java list all non directory files in the directory
- tower of hanoi program in java using recursion