6个回答
展开全部
你可以使用map
拿"1" “2” “3” “4” “5” .....当键 key
壹,"贰","叁","肆","伍".. 当值 value
如:
Map hanzi = new HashMap();
hanzi.put("1","壹");
hanzi.put("2","贰");
hanzi.put("3","叁");
hanzi.put("4","肆");
hanzi.put("5","伍");
然后你就可以按照你输入的 "1“ ”2" " 3“ ”4“ ”5” (注意啊这写12345 也都是字符串啊)来获取 壹,"贰","叁","肆","伍 了
拿"1" “2” “3” “4” “5” .....当键 key
壹,"贰","叁","肆","伍".. 当值 value
如:
Map hanzi = new HashMap();
hanzi.put("1","壹");
hanzi.put("2","贰");
hanzi.put("3","叁");
hanzi.put("4","肆");
hanzi.put("5","伍");
然后你就可以按照你输入的 "1“ ”2" " 3“ ”4“ ”5” (注意啊这写12345 也都是字符串啊)来获取 壹,"贰","叁","肆","伍 了
展开全部
java语言中的标识符由字母、数字、下划线“_”、美元符号“$”组成,并且首字母不能是数字。
可以定义5个String类型的变量如:
String str1=“壹”;
String str2=“贰”;
String str3=“叁”;
String str4=“肆”;
String str5=“伍”;
或者一个String类型的数组:
String[] num={"壹","贰","叁","肆","伍"};
可以定义5个String类型的变量如:
String str1=“壹”;
String str2=“贰”;
String str3=“叁”;
String str4=“肆”;
String str5=“伍”;
或者一个String类型的数组:
String[] num={"壹","贰","叁","肆","伍"};
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用等号呀
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
String[] myInt = {"壹","贰","叁","肆","伍"...... };
//你给我一个int的数字,我就给你一个字符
public String getNewInt(int i) {
return myInt[i-1];
}
//你给我一个int的数字,我就给你一个字符
public String getNewInt(int i) {
return myInt[i-1];
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public class testaa {
public static void main(String[] args) {
HashMap<Integer, String> tbale = new HashMap<Integer, String>();
tbale.put(1,"壹");
tbale.put(2,"贰");
tbale.put(3,"叁");
tbale.put(4,"肆");
tbale.put(5,"伍");
tbale.put(6,"陆");
tbale.put(7,"柒");
Scanner s = new Scanner(System.in);
System.out.print("请输入一个1到7的整数:");
int a = s.nextInt();
System.out.println("大写为:" + tbale.get(a));
}
}
public static void main(String[] args) {
HashMap<Integer, String> tbale = new HashMap<Integer, String>();
tbale.put(1,"壹");
tbale.put(2,"贰");
tbale.put(3,"叁");
tbale.put(4,"肆");
tbale.put(5,"伍");
tbale.put(6,"陆");
tbale.put(7,"柒");
Scanner s = new Scanner(System.in);
System.out.print("请输入一个1到7的整数:");
int a = s.nextInt();
System.out.println("大写为:" + tbale.get(a));
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询