java get an int from a char
char charValue = '2';
int intValue = Character.getNumericValue(charValue); // 2
java get an int from a char
char charValue = '2';
int intValue = Character.getNumericValue(charValue); // 2
converting char to int in java
public class JavaExample{
public static void main(String args[]){
char ch = '9';
/* Since parseInt() method of Integer class accepts
* String argument only, we must need to convert
* the char to String first using the String.valueOf()
* method and then we pass the String to the parseInt()
* method to convert the char to int
*/
int num = Integer.parseInt(String.valueOf(ch));
System.out.println(num);
}
}
convert char to char*
char c;
char *pChar = &c;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us