Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Scanner scan = new Scanner(System.in); // Create a Scanner Object to work on first
  2. System.out.println("Enter xyz") // Ask user a question
  3. String answer; // Initialize the string variable to record answer, note below
  4.  
  5. You can use one of many ways to assign data to the string depending on how much you want to copy. For example
  6.  
  7. String answer = scan.nextLine(); // Capture text separated by the Enter key
  8. int answer = scan.nextInt(); // Capture integer to variable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement