JAVA如何把数字1-9转换成英文单词1-9
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/16 18:08:56
JAVA如何把数字1-9转换成英文单词1-9
放到一个数组最简单了,根据数字去索引.
import java.util.Scanner;
public class Du3 {
public static void main(String[] args) {
String[] numsAry = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
Scanner scanner = new Scanner(System.in);
System.out.print("Please input a number between 1 and 9: ");
int num = scanner.nextInt();
System.out.println(num + " to corresponding string is: " + numsAry[num]);
}
}
----------------
Please input a number between 1 and 9: 5
5 to corresponding string is: five
import java.util.Scanner;
public class Du3 {
public static void main(String[] args) {
String[] numsAry = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
Scanner scanner = new Scanner(System.in);
System.out.print("Please input a number between 1 and 9: ");
int num = scanner.nextInt();
System.out.println(num + " to corresponding string is: " + numsAry[num]);
}
}
----------------
Please input a number between 1 and 9: 5
5 to corresponding string is: five
JAVA如何把数字1-9转换成英文单词1-9
JAVA如何把数字转换成英文字母?
如何把数字转换英文单词,类似手机数字键盘
java中如何把大写字母转换成小写字母,小写字母转换成大写字母
java random 如何取得小于等于1的数字?
excel里如何把数字转换成英文货币表达
谁能把数字9至0的英文单词告诉我
java打印数字三角形 1 5 2 8 6 3 10 9 7 4
java如何让random出来的double数字在[0.3,1)之间?
cad如何把比例尺1:200转换成1:100
请问java如何生成大量数字英文单词的13位随机数大概5.5亿条只求不重复
怎么把英文单词转换成ascii编码的字符串