SSC MTS EXAM

SSC

COMPUTER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What command is used to change a string into a number?
A
chr
B
dec
C
int
D
str
Explanation: 

Detailed explanation-1: -This method returns the string as a primitive type int. If the string does not contain a valid integer then it will throw a NumberFormatException.

Detailed explanation-2: -The toInt() function allows you to convert a String to an integer number. In this example, the board reads a serial input string until it sees a newline, then converts the string to a number if the characters are digits.

Detailed explanation-3: -If successfully executed, the function returns the integer value. If the string starts with an alphanumeric character or only contains alphanumeric characters, 0 is returned. More items

There is 1 question to complete.