【发布时间】:2020-02-20 06:11:27
【问题描述】:
public static boolean hasLower ( String text){
char c;
System.out.println( "Enter Text Here: : ");
c = scan.nextChar();
for ( int i = 0; i < text.length(); i++){
c = text.charAt(i);
if ( c <= 97 && c >= 122) {
return true;
}//end if
}//end for
return false;
}//end hasLowers
我有这个,但我想弄清楚如何在没有 ASCII 的情况下做到这一点
然后我从另一个文件打印它,这就是我所拥有的这应该打印出所使用的字符串的小写字母,即文本。我尝试使用布尔方法来确定它是真的还是 假的。
Lab7Methods.hasLower ( text ); System.out.println();
【问题讨论】:
-
c不能是 = 122。这将始终返回 false。