|
蓝森林 http://www.lslnet.com 2006年6月6日 10:18
java 的问题
在java中字符是不是没有办法比较大小啊?
还有是不是字符没有办法自加啊
比如 char a;
a++;
可以吗?
class bi
{
public static void main(String[] args)
{
for(int i="A";i<="C";i++)
for(int j="A";j<="C";j++)
for(int k="A";k<="C";k++)
if("A"!=(char)i&&"C"!=(char)k&&i!=j!=k)
System.out.print("i="+i,"j="+i,"k="+k);
}
}
错在那了 |
java 的问题
[b]请楼主修改一下标题,不要用这样太概括性的标题。[/b]
你把char和String的常量的写法混淆了:可以看一下这个程序:
[code]
class CharTest
{
public static void main(String[] args)
{
char a='a';
a++;
System.out.println(a);
for (char i='a';i<'z' ;i++ )
{
System.out.print(i);
System.out.print("\t");
}
}
}
[/code] |
java 的问题
我试了一下得到以下结果
<I style="color:red;background-color:blak">; b
a b c d e f g h i j
k l m n o p q r s t</b>;
u v w x y |
java 的问题
字符要用 ' '
不能用" " |
| |