Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main (String[] args){
- //Create scanner object
- Scanner input = new Scanner(System.in);
- // Output the prompt
- System.out.println("Enter a line of text: ");
- // Wait for the user to enter a line of text
- String line = input.nextLine();
- // Tell them what they entered
- System.out.println("You entered: " + line);
- //Create scanner object
- Scanner input2 = new Scanner(System.in);
- // Output the prompt
- System.out.println("Enter an integer: ");
- // Wait for the user to enter something
- int value = input.nextInt();
- // Tell them what they entered
- System.out.println("You entered: " + value);
- //Create scanner object
- Scanner input3 = new Scanner(System.in);
- // Output the prompt
- System.out.println("Enter an decimal number: ");
- // Wait for the user to enter something
- double decimal = input.nextDouble();
- // Tell them what they entered
- System.out.println("You entered: " + decimal);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement