Given the following code:
String string = "0";
int x = Integer.parseInt (string);Which of these statements is correct and why?
A) The code goes in error because the variable string is not an integer
B) The code does not in error because the string "0" converts to the number 0
C) The code goes in error because the method parseInt () is not static is then to invoke it must instantiate an object of class Integer
Given the following code:
String string = "Hello";
int x = Integer.parseInt (string);Which of these statements is correct and why?
A) The code goes in error because the variable string is not an integer
B) The code goes in error because the JVM tries to convert the string "Hello" in a number but the conversion fails
C) The code goes in error because the method parseInt () is not static is then to invoke it must instantiate an object of class Integer