in java check if string contains two character code example Example: check if a string contains a character java string.indexOf('a')