Ask Question
11 December, 20:56

Which method call converts the value in variable stringVariable to an integer?

Integer. parseInt (stringVariable);

Convert. toInt (stringVariable);

Convert. parseInt (stringVariable);

Integer. toInt (stringVariable);

+1
Answers (1)
  1. 12 December, 00:56
    0
    The correct answer for the given question is Integer. parseInt (string variable);

    Explanation:

    Integer. parseInt (string variable); is the method in a java programming language that convert the string into the integer value. It takes a string variable and converted into the integer.

    Following are the program in java which convert the string value into an integer value.

    class Main

    {

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

    {

    String str1 = "10009";

    / / variable declaration

    int k = Integer. parseInt (str1);

    / / convert the string into integer.

    System. out. println ("Converted into Int:" + k);

    }

    }

    Output:

    Converted into Int:10009

    Convert. toInt (stringVariable);

    Convert. parseInt (stringVariable, Integer. toInt (stringVariable); are not any method to convert the string into integer.

    Therefore the correct answer is : Integer. parseInt (stringVariable);
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Which method call converts the value in variable stringVariable to an integer? Integer. parseInt (stringVariable); Convert. toInt ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers