DNA Sequencing: Static variable error

I’m trying to do the DNA Sequencing project in Java, and I think I am missing some small detail that is resulting in an error, but I have been unable to figure out what it is.
here is my program so far:

// DNA Sequencing
public class DNA{
String dna1 = “ATGCGATACGCTTGA”;
String dna2 = “ARGCGATACGTGA”;
String dna3 = “ATTAATATGTACTGA”;

String dna = dna1;

public static void main(String args){
int length = dna.length();
System.out.println("Length: " + length);
}

// -. .-. .-. .-. .
// \ \ / \ \ /
// / \ \ / \
// ~ -~ - -~ `-

}

and here is the error:

Output:
DNA.java:10: error: non-static variable dna cannot be referenced from a static context
int length = dna.length();
^
1 error

Can someone help me figure out why this error is occurring?

if the variable is not static, then you would have to create an object to use the variable (an instance of the class).
You can do that by having
DNA dnaObject = new DNA();

all that code

One option is to make a DNA object/instance.

public class DNA{
  String dna1 = "ATGCGATACGCTTGA";
  String dna2 = "ARGCGATACGTGA";
  String dna3 = "ATTAATATGTACTGA";

  String dna = dna1;

  public static void main(String args){
    DNA dnaObject = new DNA(); // created new DNA object called dnaObject
    int length = dnaObject.dna.length();
    System.out.println("Length: " + length);
  }
}

Another option to make that code work is to make everything static,
so that there doesn’t have to be an object to to dna.length() ;
but I think that is not what you are expected to do in this project.

public class DNA{
  public static String dna1 = "ATGCGATACGCTTGA";
  public static dna2 = "ARGCGATACGTGA";
  public static String dna3 = "ATTAATATGTACTGA";

  public static String dna = dna1;

  public static void main(String args){
    int length = dna.length();
    System.out.println("Length: " + length);
  }
}