what is the output of this java code
public String mystery(String dna) {
int pos = dna.indexOf("T");
int count = 0;
int startPos = 0;
String newDna = "";
if (pos == -1) {
return dna;
}
while (count < 3) {
count += 1;
newDna = newDna + dna.substring(startPos,pos);
startPos = pos+1;
pos = dna.indexOf("T", startPos);
if (pos == -1) {
break;
}
}
newDna = newDna + dna.substring(startPos);
return newDna;
}
Answers
Answered by
0
Answer:
Hello how are you
I hpe you are also fine
Similar questions