mercredi 20 octobre 2021

I don't get it Why it can't detect “+” symbol [duplicate]

I don't get it why it can't detect “+” symbol below this script please help.

public class Main {
    public static void main(String[] args) {
        String r_text = "10 + 10 + 10";
        
        String count = "";
        
        for (int i = 0; i < r_text.length(); i++){
            Object x = r_text.charAt(i);
            String c  = x.toString();
            
            if (c != "+"){
                System.out.println(c);
            }
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire