Answers for "to ascii code java"

2

ascii in java

public class AsciiValue {

    public static void main(String[] args) {

        char ch = 'z';
        int ascii = ch;
        // You can also cast char to int
        int castAscii = (int) ch;

        System.out.println("The ASCII value of " + ch + " is: " + ascii);
        System.out.println("The ASCII value of " + ch + " is: " + castAscii);
    }
}
Posted by: Guest on April-09-2021
0

string into ascii in java

// A simple cast from String to int will do the job
String me = "a";
int me_ASCII = (int) me;
// 97
Posted by: Guest on April-20-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language