-2
I have a problem with this method. It seems to me, whenever I try to use it with some String, I get false for the value of a, even if the string contains these three characters. Someone can tell me what’s wrong here?
public static boolean VerSeTemLetras (String qqString){
boolean a;
int tem_a;
int tem_b;
int tem_c;
if (qqString.contains("a")) {
tem_a = 1;
} else {
tem_a = 0;
}
if (qqString.contains("b")) {
tem_b = 1;
} else {
tem_b = 0;
}
if (qqString.contains("c")) {
tem_c = 1;
} else {
tem_c = 0;
}
a = ((tem_a + tem_b + tem_c) > 2 );
return a;
}
The purpose is to know if the
Stringhasa,bandcor is to find out whether it containsa,borc?– Victor Stafusa
Gives to greatly improve your code, what you want to know exactly?
– PauloHDSousa