Ask Question
16 September, 15:50

Assign the size of userInput to stringSize. Ex: if userInput is "Hello", output is: Size of userInput: 5

+4
Answers (1)
  1. 16 September, 19:29
    0
    import java. util. Scanner;

    public class StringSize {

    public static void main (String [] args) {

    Scanner scnr = new Scanner (System. in);

    String userInput;

    int stringSize;

    userInput = scnr. nextLine ();

    / * Your solution goes here * /

    stringSize = userInput. length ();

    System. out. println ("Size of userInput: " + stringSize);

    return;

    }

    }

    Explanation:

    stringSize = userInput. length (); / / userInput. length () will get the length of the string and put in stringSize
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Assign the size of userInput to stringSize. Ex: if userInput is "Hello", output is: Size of userInput: 5 ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers