急啊,应该不难,就是找不到API 用ASC码方法好了 A=63把好像然后你就1+。。然后用CHAR打出不就可以了这样行不 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 char intToChar(int i){ char c = (char)(i + 64); return c;} up 楼上的先import java.io.*;public class convert{ public static void main( String[] args ){ System.out.println( "Please input the number(1-26):"); int number = 0; try{ number = 16+(int)System.in.read(); } catch(IOException e) {} System.out.println( "output char(A-Z):"+(char)number+"\n"); }} import java.io.*;public class Comput{ public void run() throws IOException{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter 1~26"); String numstu = reader.readLine(); int num = Integer.parseInt(numstu)+64; char a = (char)num; System.out.println(a); } public static void main(String[] args) throws Exception{ Comput tpo = new Comput(); tpo.run(); }} eidolon_warrior(精灵_战士),你的那个程序好像有点问题,好像每次只会把每次输入的第一个数字转化为B,具体原因不明:)我也是个初学者,所以试着编译了一下 char lower; char upper; int index = 1; /* 1-26 */ lower = Character.forDigit(index + 9, Character.MAX_RADIX); upper = Character.toUpperCase(lower); System.out.println(upper); 自己写方法来吧。^_^。public String numbertoAlpha(int[] j){ String str = ""; for(int i=1;i<27;i++) { str=str+(char)(i+64); } return str;} 关于Graphics的用法问题 求教有关filedialog的问题? 这段数据库代码 什么意思 程序 空指针异常 哪位大侠能介绍下java下的Date和Timestamp的区别,and他们在应用中不同的特点和适用范围 毕设迷茫,请高手指点迷津! finalize();是干吗用的? java 的简单问题 11 ??? ☆☆★★☆☆★★ Swing 的一个简单问题 ☆☆★★☆☆★★ 大家好,我想学JAVA,不知道学哪个公司的好?我是新手 關於jfc的問題! 非常不可思议的文件重命名(不好意思,因为没分了)
char c = (char)(i + 64);
return c;
}
public class convert{
public static void main( String[] args ){
System.out.println( "Please input the number(1-26):");
int number = 0;
try{
number = 16+(int)System.in.read();
}
catch(IOException e)
{}
System.out.println( "output char(A-Z):"+(char)number+"\n");
}
}
public class Comput{
public void run() throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter 1~26");
String numstu = reader.readLine();
int num = Integer.parseInt(numstu)+64;
char a = (char)num;
System.out.println(a);
}
public static void main(String[] args) throws Exception{
Comput tpo = new Comput();
tpo.run();
}
}
你的那个程序好像有点问题,好像每次只会把每次输入的第一个数字转化为B,具体原因不明:)我也是个初学者,所以试着编译了一下
char upper;
int index = 1; /* 1-26 */ lower = Character.forDigit(index + 9, Character.MAX_RADIX);
upper = Character.toUpperCase(lower);
System.out.println(upper);
{
String str = "";
for(int i=1;i<27;i++)
{
str=str+(char)(i+64);
}
return str;
}