Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner; // Import the Scanner class
- class MyClass {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in); // Create a Scanner object
- System.out.println("Please enter the value you want to store:"); // Output text to the terminal
- String userInput = scan.nextLine(); // Read user input and store in a variable
- System.out.println("Your value is: " + userInput); // Output user input
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement