I am a newbie in Java and having difficulty in returning a single string from a method that has multiple for loops, each loop iterating 25 times and returning a pass/fail for each iteration. I'm trying to figure out what to do so if any of the for loops return a "fail" the over all method returns a fail, otherwise it just returns a "pass"? Following is a generic code I have.
public String myMethod (String string, String string2) {
for (int i = 0; i < 25 ; i++){
B = string1 + i + string 2;
if (B.equals("something"){
return "Pass";
}else{
return "Fail";
}
for (int j = 0; j < 25 ; j++) {
C = string3 + i + string 4;
if (C.equals("something")){
return "Pass";
}else{
return "Fail";
}
for (int k = 0 ; k < 25 ; k++) {
D = string4 + i + string 5;
if (D.equals("something")){
return "Pass";
}else{
return "Fail";
}
}
string[1345]defined in this code. Without the full code, and howmyMethodis called, no help is possible