Ask Question

Which of the following can be used to get an integer value from the keyboard?

Integer. parseInt (stringVariable);

Convert. toInt (stringVariable);

Convert. parseInt (stringVariable);

Integer. toInt (stringVariable);

+4
Answers (1)
  1. 10 June, 11:08
    0
    Integer. parseInt (stringVariable);

    Explanation:

    This function is used to convert the string into integer in java. Following are the program that convert the string into integer in java.

    public class Main

    {

    public static void main (String[] args) / / main method

    {

    String num = "1056"; / / string variable

    int res = Integer. parseInt (num); / /convert into integer

    System. out. println (res); / / display result

    }

    }

    Output:1056

    Therefore the correct answer is:Integer. parseInt (stringVariable);
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Which of the following can be used to get an integer value from the keyboard? Integer. parseInt (stringVariable); Convert. toInt ...” 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