Ask Question
23 November, 22:17

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

+4
Answers (1)
  1. 23 November, 22:45
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers