DNA Sequencing

Whenever I run my code I get two errors: DNA.java:3: error: expected
public static void main(String{} args) {
^
DNA.java:3: error: expected
public static void main(String{} args) {

Below is my code:
public class DNA {
// DNA Sequencing
public static void main(String{} args) {
String dna1 = “ATGCGATACGCTTGA”; // 0 - 2, 12 - 14
String dna2 = “ATGCGATACGTGA”; // 0 - 2, 10 - 12
String dna3 = “ATTAATATGTACTGA”; // 0, 2, 12 - 14
String dna = dna1;
int length = dna.length();
System.out.println("Length: " + length);
int start = dna.indexOf(“ATG”);
System.out.println("Start: " + start);
int stop = dna.indexOf(“TGA”);
System.out.println("Stop: " + stop);

if (start != -1 && stop != -1 && (stop - start) % 3 == 0) {
  System.out.println("Condition 1 and 2 are satisfied"); 
  String protein = dna.substring(start, stop + 3);
  System.out.println("Proteins: " + protein); 
  } else {
    System.out.println("No protein"); 
    }
    }
    }

You wrote:
public static void main(String{} args) {
but you should use different type of brackets in String

1 Like

Thanks. It wroks now hehehehehehe