title: Why am I getting compiler errors, "illegal start of expression"?
body: <p>The "illegal start of expression" errors are with these 3 statements in TestPayroll class.  Thanks in advance. </p>
  
  <pre><code>private String [] name = {"Tiny Tim", "Brad Pitt", "Madonna"};
  
  private double [] payRate = {100.25, 150.50, 124.25};
  
  private double [] hrsWorked = {40, 35, 36};
  </code></pre>
  
  <p>TestPayroll.java below:</p>
  
  <pre><code>/**
  This program contains a Payroll class that has private data members for an employee's full name, hourly rate pay, number of hours worked, and total pay for the week. There is an array of 3 Payroll objects, which is instantiated manually with the number of hours each employee worked.  The program displays the amount of gross pay each employee has earned.  
  */
  
  import javax.swing.JOptionPane;
  
  public class TestPayroll {
  
  public static void main(String[] args) {
  
      private String [] name = {"Tiny Tim", "Brad Pitt", "Madonna"};
      private double [] payRate = {100.25, 150.50, 124.25};
      private double [] hrsWorked = {40, 35, 36};
  
      //Payroll object
      Payroll calcPay = new Payroll(name, weeksPay);
  
      //Display weekly pay
      JOptionPane.showMessageDialog(null, "This week's pay for " + name[0].getName + " is " + payroll.getWeeksPay() +"\n" + "This week's pay for " + name[1].getName + " is " + payroll.getWeeksPay() + "\n" + "This week's pay for " + name[2].getName + " is " + payroll.getWeeksPay());
  
  }   
  
  }
  
  public class Payroll {
  
  public static void main(String[] args) {
  
      private String name;
      private double payRate;
      private double hrsWorked;
      private double weeksPay;
  
      //default constructor
      public Payroll() {
          this.name = name;
          this.payRate = payRate;
          this.hrsWorked = hrsWorked;
          this.weeksPay = weeksPay;
      }
  
      //Payroll constructor
      public Payroll(String name, double payRate, double hrsWorked, double weeksPay) {
          this.name = name;
          this.payRate = payRate;
          this.hrsWorked = hrsWorked;
          this.weeksPay = weeksPay;
      }
  
      //return name
      public String getName() {
          return name;
      }
  
      //set name
      public void setName(String name) {
          this.name = name;
      }
  
      //return pay rate
      public double getPayRate() {
          return payRate;
      }
  
      //set pay rate
      public void setPayRate(double payRate) {
          this.payRate = payRate;
      }
  
      //return hours worked for the week
      public double getHrsWorked() {
          return hrsWorked;
      }
  
      //set hours worked for the week
      public void setHrsWorked(double hrsWorked) {
          this.hrsWorked = hrsWorked;
      }
  
      //find week's pay
      public double getWeeksPay(double weeksPay) {
          double weeksPay = payRate * hrsWorked;
          return weeksPay;
      }   
  
  }
  }
  </code></pre>