51,396
社区成员




import java.util.Scanner;
public class Test1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("请输入数字:");
Scanner input = new Scanner(System.in);
String count = input.next();
for(int i=0;i<=count.length()-1;i++) {
if(count=="0") {
System.out.println("零");
}else if(count=="1") {
System.out.println("一");
}else if(count=="2") {
System.out.println("二");
}else if(count=="3") {
System.out.println("三");
}else if(count=="4") {
System.out.println("四");
}else if(count=="5") {
System.out.println("五");
}else if(count=="6") {
System.out.println("六");
}else if(count=="7") {
System.out.println("七");
}else if(count=="8") {
System.out.println("八");
}else if(count=="9") {
System.out.println("九");
}
char ch = count.charAt(i);
String str = String.valueOf(ch);
System.out.print(str);
}
}
}
提供另外一种思路:ASCII码