Hello everybody im new to the board. I recently started tring to learn Java programing. I have a problem with my code giving me this error when I try to run it can anyone help me out.This is the exception that I am getting.
Exception in thread "main" java.lang.NullPointerException
at calc.Calc.main(Calc.java:57)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)
Thanks in advance.
package calc; /** * * @author */ import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; public class Calc extends JFrame { public static JPanel panel; public static JFrame frame; public static JTextField input; public static JTextField output; public static JButton calculate; public static JButton clear; public static JButton quit; public Calc(){ setLayout(new FlowLayout ()); calculate = new JButton("Calculate"); clear = new JButton("Clear"); quit = new JButton("Quit"); JFrame frame = new JFrame(); JPanel panel = new JPanel(); frame.add(panel); panel.add(output); frame.setVisible(true); panel.setVisible(true); quitevent quitevent = new quitevent(); clearevent clearevent = new clearevent(); ooop ooop = new ooop(); quit.addActionListener(quitevent); clear.addActionListener(clearevent); calculate.addActionListener(ooop); } public class quitevent implements ActionListener { public void actionPerformed(ActionEvent quitevent){ } } public class clearevent implements ActionListener{ public void actionPerformed(ActionEvent clearevent){ } } public class ooop implements ActionListener{ public void actionPerformed(ActionEvent ooop){ }} public static void main(String args[]){ frame.add(panel); } }