How to Compare a String with a Char

The first thing I would say to any of my junior devs is to not use the word "try" as a method name, because try is a reserved keyword in java.

Secondly think that there are a few things which you need to consider in your method.

If you compare things of two different types they will never be the same. A String can be null. How long the string is. The first char.

I would write the method like :

public boolean isSame() {
    if (s != null && s.length() == 1 { 
        return s.charAt(0) == c;
    }
    return false;
}

Either use char comparison (assuming s will always be of length 1):

return c == s.charAt(0);

Or use String comparison:

return s.equals(new String(new char[]{c}));