Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner scan = new Scanner(System.in); // Create a Scanner Object to work on first
- System.out.println("Enter xyz") // Ask user a question
- String answer; // Initialize the string variable to record answer, note below
- You can use one of many ways to assign data to the string depending on how much you want to copy. For example
- String answer = scan.nextLine(); // Capture text separated by the Enter key
- int answer = scan.nextInt(); // Capture integer to variable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement