DNA Sequencing

If I put input dna1 , out was no DNA , I didn’t find any error. SS attached. please help.

public class DNA {

public static void main (String args) {
// DNA Sequencing
// -. .-. .-. .-. .
// \ \ / \ \ /
// / \ \ / \ \
// ~ -~ - -~ `-
String dna1 = “ATGCGATACGCTTGA”;
String dna2 = “ATGCGATACGTGA”;
String dna3 = “ATTAATATGTACTGA”;
String dna = dna3;
//int length = dna.length();
int start = dna.indexOf(“AGT”);
int end = dna.indexOf(“TGA”);
System.out.println(dna.length());
System.out.println(start);
System.out.println(end);
if (start != -1 && end != -1 && (end - start) % 3 == 0) {
String protein = dna.substring(start,end+3);
System.out.println(“Protein” + protein);
} else {
System.out.println("No protein. ");
}

}
}

I don’t see "AGT" in dna1 or in dna2 or dna3

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.