public class llearning1 {
    public static void main(String[] args) {
        String text = "is";
        String x = "what is good";
        String y[] = x.split(" ");
        for (String temp: y) {
            if (temp == text) {
                System.out.println("found");
            } else {
                System.out.println("nothing");
            }
        }
    }
}
output:
expected : code should display "found"
but it is displaying "nothing"
 
     
    