日期:2014-05-20 浏览次数:20677 次
import java.util.*;
public class Test3{
public static void main(String[] args)
{
getChar tw = new getChar();
char ch = tw.getChar();
System.out.println(ch);
}
public char getChar() {
Scanner s = new Scanner(System.in);
String str = s.nextLine();
char ch = str.charAt(0);
if(ch<'a' || ch>'Z') {
System.out.println("输入错误,请重新输入");
ch=getChar();
}
return ch;
}
}
getChar tw = new getChar();//这个写错了吧??
if(ch<'a'
------解决方案--------------------
ch>'Z') //这个不能判断是不是字母啊。。。
package cn.test;
import java.util.Scanner;
public class Test3{
public static void main(String[] args)
{
Test3 tw = new Test3();
char ch = tw.getChar();
System.out.println(ch);
}
public char getChar() {
Scanner s = new Scanner(System.in);
String str = s.nextLine();
char ch = str.charAt(0);
if(ch<'a'
------解决方案--------------------
ch>'Z') {
System.out.println("输入错误,请重新输入");
}
return ch;
}
}
public char getChar() {
Scanner s = new Scanner(System.in);
String str = s.nextLine();
char ch = str.charAt(0);
if(ch<'A'
------解决方案--------------------
ch>'z') {
System.out.println(ch);
System.out.println("输入错误,请重新输入");
getChar();
}
return ch;
}
import java.util.*;
public class Test3{
public static void main(String[] args)
{
Test3 tw = new Test3();
char ch = tw.getChar();