Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assign the size of userInput to stringSize. Ex: if userInput = \"Hello\", output

ID: 670697 • Letter: A

Question

Assign the size of userInput to stringSize. Ex: if userInput = "Hello", output is:
 Size of userInput: 5 
 using java 
 import java.util.Scanner;  public class StringSize {    public static void main (String [] args) {       String userInput = "";       int stringSize = 0;        userInput = "Hello";         //solution here                 System.out.println("Size of userInput: " + stringSize);        return;    } } 
Assign the size of userInput to stringSize. Ex: if userInput = "Hello", output is:
  Size of userInput: 5  
  using java  
  import java.util.Scanner;    public class StringSize {     public static void main (String [] args) {        String userInput = "";        int stringSize = 0;          userInput = "Hello";           //solution here                    System.out.println("Size of userInput: " + stringSize);          return;     }  }  

Explanation / Answer

stringSize = userInput.length();