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

后端 未结 3 1252
眼角桃花
眼角桃花 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:36

    The type of main() is void (public static void main(String args[]) {) and therefore you cannot return a value from it.

    The actual error I get when I run this is:

    Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    Void methods cannot return a value
    

提交回复
热议问题