title: Defining methods and variables
body: <p>I am a beginner and I am trying to understand what is <strong>static, private, public</strong>. Please see the following example written by me. It works, but I have very big doubts whether this is a correct way of <strong>defining variables and methods</strong>. Thanks in advance!</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.Date; 
  import java.text.ParseException;
  import java.text.SimpleDateFormat;
  
  public class Biorhytm {
  
  private static String nameOne;
  private static String nameTwo;
  private static String dobOneIn;
  private static String dobTwoIn;
  private static Date dobOne;
  private static Date dobTwo;
  static int diff;
  
  public static Date getDobOne() {
      return dobOne;
      }
  
  public static void setDobOne(Date dobOne) {
      Biorhytm.dobOne = dobOne;
      }
  
  public static Date getDobTwo() {
      return dobTwo;
      }
  
  public static void setDobTwo(Date dobTwo) {
      Biorhytm.dobTwo = dobTwo;
      }
  
  public static String getDobOneIn() {
      return dobOneIn;
      }
  
  public static void setDobOneIn(String dobOneIn) {
      Biorhytm.dobOneIn = dobOneIn;
      }
  
  public static String getDobTwoIn() {
      return dobTwoIn;
      }
  
  public static void setDobTwoIn(String dobTwoIn) {
      Biorhytm.dobTwoIn = dobTwoIn;
      }
  
  public static String getNameOne() {
      return nameOne;
      }
  
  public static void setNameOne(String nameOne) {
      Biorhytm.nameOne = nameOne;
      }
  
  public static String getNameTwo() {
      return nameTwo;
      }
  
  public static void setNameTwo(String nameTwo) {
      Biorhytm.nameTwo = nameTwo;
      }
  
  public static int diffCalc() {
      return diff = Math.abs((int)((getDobOne().getTime() - getDobTwo().getTime()) / (24 * 60 * 60 * 1000)));
  }
  
  public static void main(String[] args) {
  
          float physicalBio;
          float emotionalBio;
          float intellectualBio;
          boolean validEntry;
  
          Scanner input = new Scanner(System.in);
  
          SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");
          SimpleDateFormat format2 = new SimpleDateFormat("EEEE, MMMM d, yyyy", java.util.Locale.US);
  
          System.out.println("Enter name of first person!");
          setNameOne(input.nextLine());
  
              if (getNameOne().equals("")) {
                  setNameOne("first person");
              }
  
              System.out.println("Enter name of second person!");
              setNameTwo(input.nextLine());
  
              if (getNameTwo().equals("")) {
                  setNameTwo("second person");
              }
  
           do {
                  try {
                      System.out.println("Enter date of birth of " + getNameOne() + "! (MM/DD/YYYY)");
                      setDobOneIn(input.nextLine());
                      setDobOne(format.parse(getDobOneIn()));
                      validEntry = true;
                      }
                  catch (ParseException e) {
                      validEntry = false;
                       }
              } while (!validEntry);
  
           do {
                  try {
                      System.out.println("Enter date of birth of " + getNameTwo() + "! (MM/DD/YYYY)");
                      setDobTwoIn(input.nextLine());
                      setDobTwo(format.parse(getDobTwoIn()));
                      validEntry = true;
                      }
                  catch (ParseException e) {
                      validEntry = false;
                       }
              } while (!validEntry);
  
          System.out.println();
          System.out.println("DOB of " + getNameOne() + ": " + format2.format(getDobOne()) + ".");
          System.out.println("DOB of " + getNameTwo() + ": " + format2.format(getDobTwo()) + ".");
          System.out.println("Difference between DOBs (days): " + diffCalc() + ".");
  
          physicalBio = diffCalc() % 23;
          emotionalBio = diffCalc() % 28;
          intellectualBio = diffCalc() % 33;
  
          physicalBio /= 23;
          emotionalBio /= 28;
          intellectualBio /= 33;
  
          if (physicalBio &gt; 0.5) {
              physicalBio = 1 - physicalBio;
          }
  
          if (emotionalBio &gt; 0.5) {
              emotionalBio = 1 - emotionalBio;
          }
  
          if (intellectualBio &gt; 0.5) {
              intellectualBio = 1 - intellectualBio;
          }
  
          physicalBio = 100 - (physicalBio * 100);
          emotionalBio = 100 - (emotionalBio  * 100);
          intellectualBio = 100 - (intellectualBio * 100);
  
          System.out.println("Physical compatibility: " + java.lang.Math.round(physicalBio) + " %.");
          System.out.println("Emotional compatibility: " + java.lang.Math.round(emotionalBio) + " %.");
          System.out.println("Intellectual compatibility: " + java.lang.Math.round(intellectualBio) + " %.");
  
  }
  
  }
  </code></pre>