程序为什么报错?


public class CharacterCompare {

public static void main(String args[]) {

Character char1 = new Character('h');

Character char2 = new Character('H');

boolean b = char1.equals(char2);

System.out.println(char1+"和"+char2+"是否相等:"+b);

Character char3 = Character.toLowerCase(char1);

Character char4 = Character.toLowerCase(char2);

boolean bb = char3.equals(char4);

System.out.println(char3+"和"+char4+"是否相等:"+bb);

}

}

http://img.mukewang.com/58b82016000194e809080443.jpg

慕粉3347856
浏览 1256回答 3
3回答

望远

Character没有tolowercase方法。

田心枫

这是eeclipse抛出的错,你在idea里面运行就没问题了。你也可以点左边那个X,然后把这张类型的错误改成warning。就会正常运行了
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java