I am trying to compare char to a String but getting an error. Error
error: incompatible types: unexpected return value
code:
The main method can not return anything, it has a void type.
You can write a separate function that returns that value, assign the value to a variable, or just print the value.
public boolean strChar(String s, String p){
return p.equals(new String(new char[]{c}));
}
or
System.out.println(p.equals(new String(new char[]{c})));
or
boolean equals = p.equals(new String(new char[]{c}));