将 ASCII 代码转换成字符串的 Java 程序
要将 ASCII 转换成字符串,请使用 toString() 方法。使用此方法会返回关联的字符。
假设我们有以下 int 值,可用作我们的 ASCII 码。
int asciiVal = 89;
现在,使用 toString() 方法。
String str = new Character((char) asciiVal).toString();
示例
public class Demo {
public static void main(String []args) {
int asciiVal = 87;
String str = new Character((char) asciiVal).toString();
System.out.println(str);
}
}输出
W
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP