java语言,求ASCII码对应的字符

import java.util.Scanner;
public class test {  
  public static void main(String[] args){
   Scanner input = new Scanner(System.in);
   System.out.println("Enter an ASCII code:");
   int number=input.nextInt();
   char ch=(char)number;
   System.out.println("The character for ASCII code "+number+ " is "+ch);
  }

}

//

Enter an ASCII code:
97
The character for ASCII code 97 is a

char型数据可以转换成任意一种数值类型,反之亦然。

你可能感兴趣的:(java语言,求ASCII码对应的字符)