为了账号安全,请及时绑定邮箱和手机立即绑定

提示无法将字符串类型转换为字符型,这个报错是怎么引起的呢

HelloWorld.java:6: error: incompatible types: String cannot be converted to char
		    case "一":
		         ^
HelloWorld.java:7: error: incompatible types: String cannot be converted to char
		    case "三":
		         ^
HelloWorld.java:8: error: incompatible types: String cannot be converted to char
		    case "五":
		         ^
HelloWorld.java:11: error: incompatible types: String cannot be converted to char
		    case "二":
		         ^
HelloWorld.java:12: error: incompatible types: String cannot be converted to char
		    case "四":
		         ^
HelloWorld.java:13: error: incompatible types: String cannot be converted to char
		    case "六":
		         ^
HelloWorld.java:16: error: incompatible types: String cannot be converted to char
	        case "日":
	             ^
7 errors

http://img1.sycdn.imooc.com//6173b5be00010b1419040793.jpg

正在回答

1 回答

因为你定义的today是char  要用单引号


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

提示无法将字符串类型转换为字符型,这个报错是怎么引起的呢

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信