Could someone please help me out. I have an illegal start of an expression error at line 8 in the following code.

package untitled5;

public class Untitled1 {
  public static void main(String[] args) {

    

      public static void main(String[] args) {
        int start_system, add_modify, add_modify_animal_data, report,
            exit_system;
        int check = menu();
        while (check != 4) {
          if (check == 1) {
            add_modify_data();
          }
          else
          if (check == 2) {
            add_modify_medical_data();
          }
          else
          if (check == 3) {
            report();
          }
          check = menu();
        }

        exit_system();
        System.exit(0);
      }

      {
        public static void start_system() {
          System.out.println("Start_system now");
        }
      }
//sets up the output
        public static int menu() {
          int check;
          String output = "Modify Animal Data" + "\n " +
              "1. Add/Modify Animal Data " + "\n" +
              "2. Add/modify Meical Data " + "\n" +
              "3. Report Section " + "\n" +
              "4. Exit " + "\n " + "\n " + " Enter Your Selection:";
          String scheck = JOptionPane.showInputDialog(null, output, " ",
              JOptionPane.QUESTION_MESSAGE);
          check = Integer.parseInt(scheck);
          return check;
        }
        public static void add_modify() {
          int check1;
          while (check1 != 4) {
            if (check1 == 1) {
              add_animal_data();
            }
            else
            if (check1 == 2) {
              delete_animal_data();
            }
            else
            if (check1 == 3) {
              change_animal_data();

            }
            check1 = menu();

          }
          exit_system();
          System.exit(0);
          String output = "Modify Animal Data " + "\n " +
              "1. Add Animal Data " + "\n" +
              "2. Modify Animal Data " + "\n" +
              "3. Change Animal Data " + "\n" +
              "4. Exit " + "\n " + "\n " + " Enter Your Selection:";
          String scheck = JOptionPane.showInputDialog(null, output, " ",
              JOptionPane.QUESTION_MESSAGE);
          check1 = Integer.parseInt(scheck);
        }
        public static void add_modify_medical_data() {
          int check2;
          while (check2 != 4) {
            if (check2 == 1) {
              add_medical();

            }
            else
            if (check2 == 2) {
              delete_medical();

            }
            else
            if (check2 == 3) {
              change_medical();

            }
            check2 = menu();

          }
          exit_system();
          System.exit(0);
          String output = "Modify Medical Data " + "\n " +
              "1. Add Medical Data " + "\n" +
              "2. Modify Medical Data " + "\n" +
              "3. Change Change Data " + "\n" +
              "4. Exit " + "\n " + "\n " + " Enter Your Selection:";
          String scheck = JOptionPane.showInputDialog(null, output, " ",
              JOptionPane.QUESTION_MESSAGE);
          check2 = Integer.parseInt(scheck);
        }
        public static void report() {
          System.out.println("in Report");
        }
        public static void exit_system() {
          System.out.println("in exit system");
        };
  
    }
  }

Thank you

Edited 5 Years Ago by peter_budo: Adding code tags to old post

of course you do. :)

You're trying to declare a method inside of a method.

Remove the first public static void main method and then a ending } near the bottom of your code and that should help you out some.

Also, you have an extra ; at the end of your exit_system method.

I am getting the same error message except now it is at line 29

of course you are. :)

You really need to check your combination of open and close brackets. You must have an equal amout of both and you must fallow the java rules for declaration of attributes and methods.

I would recommend picking up a basic java book to learn these rules.

[offtopic]
Arn't the smiles here about the most evil things you've ever seen? The normal smile looks like he just took you for all you're worth.
[/offtopic]

of course you are. :)

You really need to check your combination of open and close brackets. You must have an equal amout of both and you must fallow the java rules for declaration of attributes and methods.

I would recommend picking up a basic java book to learn these rules.

[offtopic]
Arn't the smiles here about the most evil things you've ever seen? The normal smile looks like he just took you for all you're worth.
[/offtopic]

True it's more like a condescending smirk, I don't care tho... I like to antognise people...it's fun either way. :)

hi can anyone help me please. I'm having problem with my program. It's only one error illegal starts of expression in public void check (), at line 53. What it is mean?..

import javax.swing.JOptionPane;
//public class waiter{
//public static void main(String [] args)
class waiter
 
 
{
private double tab;
public waiter(String name);
{
System.out.println("My name is "+ name +", and i'll be your waiter!");
tab = 0.0;
}
public double priceof(String s);
{
double price;
if (s.equals("Chicken"))
{price = 5.95;}
else
{//burger fries
if (s.equals("burger"))
{price = 4.95; }
else
{price = 1.95;}
 
}//burger or fries
return price;
}//priceof
public void order(String s)
{
if(s.equals("Chicken"))
{
tab = tab + 5.95;
}// burger fries
else 
{//burger fries
if (s.equals("Burger"))
{
tab = tab + 4.95;
}
else
{ 
tab = tab + 1.95;
}
}//price of
 
public void check()
{
System.out.println("Please pay $" + tab+",null");
}
 
}//end of class waiter
public class objects3
{
public static void main(String [] args)
{
waiter ourwaiter;
ourwaiter = new waiter ("Manfred");// makes a waiter object
double x; //to hold price of burger
double y; //varikable to hold price of chicken
x = ourwaiter.priceof("burger");
y = ourwaiter.priceof("chicken");
if (x<y)// buy cheaper product
{
System.out.println("I'll take the burger because it's cheaper");
ourwaiter.order("Burger");
}//burger
else
{
System.out.println("I'll take the chicken. ");
ourwaiter.order("chicken");
}//chicekn
System.out.println("And i'll have fries with that");
ourwaiter.oreder("Fries");
System.out.println("\n eat eat....\n");
 
ourwaiter.check();
}//main
}//class objects3

Edited 5 Years Ago by peter_budo: Adding code tags to old post

use code tags if you want people to read your code.
And don't go hijacking other peoples' threads, not even old ones like this.

h..i can anyone help me please. I'm having problem with this program. It's only one error illegal starts of expression in public void check (), at line 53. What it is mean?..

import javax.swing.JOptionPane;

class waiter


{
private double tab;
public waiter(String name);
{
System.out.println("My name is "+ name +", and i'll be your waiter!");
tab = 0.0;
}
public double priceof(String s);
{
double price;
if (s.equals("Chicken"))
{price = 5.95;}
else
{//burger fries
if (s.equals("burger"))
{price = 4.95; }
else
{price = 1.95;}

}//burger or fries
return price;
}//priceof
public void order(String s)
{
if(s.equals("Chicken"))
{
tab = tab + 5.95;
}// burger fries
else 
{//burger fries
if (s.equals("Burger"))
{
tab = tab + 4.95;
}
else
{ 
tab = tab + 1.95;
}
}//price of

public void check()
{
System.out.println("Please pay $" + tab+",null");
}

}
public class objects3
{
public static void main(String [] args)
{
waiter ourwaiter;
ourwaiter = new waiter ("Manfred");// makes a waiter object
double x; 
double y; 
x = ourwaiter.priceof("burger");
y = ourwaiter.priceof("chicken");
if (x<y)// buy cheaper product
{
System.out.println("I'll take the burger because it's cheaper");
ourwaiter.order("Burger");
}
else
{
System.out.println("I'll take the chicken. ");
ourwaiter.order("chicken");
}
System.out.println("And i'll have fries with that");
ourwaiter.oreder("Fries");
System.out.println("\n eat eat....\n");

ourwaiter.check();
}
}

Edited 5 Years Ago by peter_budo: Adding code tags to old post

As Jwenting mentioned, you need to start a new thread with your question and place your code between code tags to make it more readable. See the post at the top of the forum about code tags.

An illegal start of expression means that you have misformatted your code and it cannot be parsed correctly. This would include things like missing braces or parens, declaring a method within a method, missing semi-colon, etc.

Hey, this thread actually HELPED me...I'm a newbie to Java. I didn't realize I was trying to declare a method from within another method. Java can be difficult to debug sometimes although the NetBeans IDE is VERY helpful.

I am trying to write a program that reads three integers and prints their average. This is what I got so far, but every time I go to compile this program so that I can run it I keep receiving one error message in reference to the "system.out..." statement saying that it is an illegal start of expression. This maybe something simple that I turned into difficult. Am I going about this the right way? Please help.

public class IntApp
{
    public static void main (String[] args)
    {

        final int BASE = 3;

       AVER = (x + y + z) / BASE;

       int x = 95;
       int y = 85;
       int z = 99;

        System.out.println ("The average of int  xyz: " + AVER +);

    }
}

Edited 5 Years Ago by peter_budo: Adding code tags to old post

    public class IntApp
    {
    public static void main (String[] args)
    {
    final int BASE = 3;
    AVER = (x + y + z) / BASE;
    int x = 95;
    int y = 85;
    int z = 99;
    System.out.println ("The average of int xyz: " + AVER +);
    }
    }

Shift

        int x = 95;
        int y = 85;
        int z = 99;

above

AVER = (x + y + z) / BASE;

Right Code:

        public class IntApp
        {
        public static void main (String[] args)
        {
        final int BASE = 3;
        int x = 95;
        int y = 85;
        int z = 99;
        AVER = (x + y + z) / BASE;
        System.out.println ("The average of int xyz: " + AVER +);
        }
        }

Welcome to DaniWeb, and thank you for trying to help here, but after three years it's probably a bit late!
ps: When you help answer people's problems please try to explain why they have the problem and how they should start to fix it themselves. Don't just post corrected code that they can copy/paste/forget.

Edited 3 Years Ago by JamesCherrill

I don't know why this isn't working?! It's something wrong with the public static void main(String args[]) {

public class Calculator extends javax.swing.JFrame {

     //Variables
    double plusminus;
    double firstDouble;
    double secondDouble;
    double totalDouble;
     //to check for button clicks
    int plusClick;
    int minusClick;
    int multiplyClick;
    int divideClick;
    int decimalClick;

    /**
     * Creates new form Calculator
     */
    public Calculator() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        display = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jButton9 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        clear = new javax.swing.JButton();
        plus = new javax.swing.JButton();
        decimal = new javax.swing.JButton();
        multiply = new javax.swing.JButton();
        minus = new javax.swing.JButton();
        divide = new javax.swing.JButton();
        equals = new javax.swing.JButton();
        posneg = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Kalkulator");

        display.setEditable(false);
        display.setFont(new java.awt.Font("Arial", 1, 16)); // NOI18N

        jButton1.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jButton1.setText("1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jButton2.setText("2");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jButton3.setText("3");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jButton4.setText("5");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton5.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jButton5.setText("4");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jButton6.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jButton6.setText("6");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jButton7.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jButton7.setText("8");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jButton8.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jButton8.setText("9");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        jButton9.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jButton9.setText("7");
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        jButton10.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        jButton10.setText("0");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        clear.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        clear.setText("C");
        clear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearActionPerformed(evt);
            }
        });

        plus.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        plus.setText("+");
        plus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                plusActionPerformed(evt);
            }
        });

        decimal.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        decimal.setText(".");
        decimal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                decimalActionPerformed(evt);
            }
        });

        multiply.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        multiply.setText("X");
        multiply.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                multiplyActionPerformed(evt);
            }
        });

        minus.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        minus.setText("-");
        minus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                minusActionPerformed(evt);
            }
        });

        divide.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        divide.setText("/");
        divide.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                divideActionPerformed(evt);
            }
        });

        equals.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        equals.setText("=");
        equals.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                equalsActionPerformed(evt);
            }
        });

        posneg.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
        posneg.setText("+/-");
        posneg.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                posnegActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(display)
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(posneg, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(equals, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(plus, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(minus, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(multiply, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(decimal, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(divide, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(0, 19, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(display, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(plus, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(minus, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(multiply, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(decimal, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(divide, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(equals, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(posneg, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>                        

    private void clearActionPerformed(java.awt.event.ActionEvent evt) {                                      
display.setText("");
decimalClick=0;
    }                                     

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
display.setText(display.getText()+jButton1.getText());
    }                                        

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
display.setText(display.getText()+jButton2.getText());
    }                                        

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                         
display.setText(display.getText()+jButton3.getText());
    }                                        

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {                                         
display.setText(display.getText()+jButton5.getText());
    }                                        

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                         
display.setText(display.getText()+jButton4.getText());
    }                                        

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {                                         
display.setText(display.getText()+jButton6.getText());
    }                                        

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {                                         
display.setText(display.getText()+jButton9.getText());
    }                                        

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {                                         
display.setText(display.getText()+jButton7.getText());
    }                                        

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {                                         
display.setText(display.getText()+jButton8.getText());
    }                                        

    private void decimalActionPerformed(java.awt.event.ActionEvent evt) {                                        
if(decimalClick==0){
    display.setText(display.getText()+decimal.getText());
    decimalClick=1;
}
    }                                       

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {                                          
display.setText(display.getText()+jButton10.getText());
    }                                         

    private void posnegActionPerformed(java.awt.event.ActionEvent evt) {                                       
plusminus=(Double.parseDouble(String.valueOf(display.getText())));
plusminus=plusminus*(-1);
display.setText(String.valueOf(plusminus));
    }                                      

    private void plusActionPerformed(java.awt.event.ActionEvent evt) {                                     
firstDouble=(Double.parseDouble(String.valueOf(display.getText())));
display.setText("");
plusClick=1;
decimalClick=0;
    }                                    

    private void minusActionPerformed(java.awt.event.ActionEvent evt) {                                      
firstDouble=(Double.parseDouble(String.valueOf(display.getText())));
display.setText("");
minusClick=1;
decimalClick=0;
    }                                     

    private void multiplyActionPerformed(java.awt.event.ActionEvent evt) {                                         
firstDouble=(Double.parseDouble(String.valueOf(display.getText())));
display.setText("");
multiplyClick=1;
decimalClick=0;
    }                                        

    private void divideActionPerformed(java.awt.event.ActionEvent evt) {                                       
firstDouble=(Double.parseDouble(String.valueOf(display.getText())));
display.setText("");
divideClick=1;
decimalClick=0;
    }                                      

    private void equalsActionPerformed(java.awt.event.ActionEvent evt) {                                       
secondDouble=(Double.parseDouble(String.valueOf(display.getText())));
if(plusClick>0){
    totalDouble=firstDouble+secondDouble;
    display.setText((String.valueOf(totalDouble)));
    firstDouble=0;
    secondDouble=0;
    plusClick=0;
}
if(minusClick>0){
    totalDouble=firstDouble-secondDouble;
    display.setText((String.valueOf(totalDouble)));
    firstDouble=0;
    secondDouble=0;
    minusClick=0;
    }                                      
if(multiplyClick>0){
    totalDouble=firstDouble*secondDouble;
    display.setText((String.valueOf(totalDouble)));
    firstDouble=0;
    secondDouble=0;
    multiplyClick=0;
}
if(divideClick>0){
    totalDouble=firstDouble/secondDouble;
    display.setText((String.valueOf(totalDouble)));
    firstDouble=0;
    secondDouble=0;
    divideClick=0;
}

    /**
     * @param args the command line arguments
     */
    **public static void main(String args[]) {**
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Calculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Calculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Calculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Calculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Calculator().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton clear;
    private javax.swing.JButton decimal;
    private javax.swing.JTextField display;
    private javax.swing.JButton divide;
    private javax.swing.JButton equals;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton minus;
    private javax.swing.JButton multiply;
    private javax.swing.JButton plus;
    private javax.swing.JButton posneg;
    // End of variables declaration                   
}

Hello MCGameSkillz
1. Do not hijack old threads to ask a new question - please start your own thread.
2. "It's something wrong with the ..." tells us nothing. If you have a compiler or runtime error message post the complete message plus the actual code it refers to. If your code is giving an incorrect result explain what result you get and what the correct result should be.
3. Don't expect people to read hundreds of lines of incorrectly indented code. Use your IDE's code formatter to fix the indentation before posting. (If you had done this then you would probably have seen immediately what you problem is (attempting to define a method inside another method).)

This article has been dead for over six months. Start a new discussion instead.