error: incompatible types: unexpected return value Char compare to String

后端 未结 3 1241
眼角桃花
眼角桃花 2020-12-12 08:04

I am trying to compare char to a String but getting an error. Error

error: incompatible types: unexpected return value

code:



        
3条回答
  •  失恋的感觉
    2020-12-12 08:57

    Characters are not objects and can / should be compared using the == operator. There is no need to build a string each time. Also the main method can't return any value, it is void.

提交回复
热议问题