I'm practicing java language.. please help me out

I got this error saying..
cannot find symbol
symbol: constructor compAdd()
location: class compAdd

compAdd c1 = new compAdd();
///////////////compAdd.java
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class compAdd extends JFrame
{
  public JButton button = new JButton("Add");
  public JTextField txt1, txt2, txt3;
  public compAdd(String title)
  {
  super(title);
  txt1 = new JTextField(5);
  txt2 = new JTextField(5);
  txt3 = new JTextField(5);
  this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  JPanel cen = new JPanel();
  cen.add(txt1);
  cen.add(txt2);
  cen.add(txt3);
  cen.add(button);
  Container contentPane = this.getContentPane();
  contentPane.add(cen, BorderLayout.CENTER);
  addMe am = new addMe(this);
  button.addActionListener(am);
  }
  
  public static void main(String [] args)
  {
    JFrame f = new compAdd("Addtion");
    f.setSize(400,400);
    f.setVisible(true);
  }
}

//////////////addMe.java
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class addMe implements ActionListener
{
  private Container container;
  public addMe(JFrame c)
  {
    container = c.getContentPane();
  }
  public void actionPerformed(ActionEvent ae)
  {
  
    String label = ae.getActionCommand();
    if (label == "Add")
    {
      int txt1,txt2,txt3;
      compAdd c1 = new compAdd();
      txt1 = Integer.parseInt(c1.txt1.getText());
      txt2 = Integer.parseInt(c1.txt2.getText());
      txt3 = txt1 + txt2;
      c1.txt3.setText(String.valueOf(txt3));
    }
  }
}

you are calling this constructor, the default constructor:

compAdd c1 = new compAdd();

but you have only provided a constructor which takes an argument (a String object)

the compiler will create a default constructor for you, so you don't have to write it, but only if it doesn't find any constructors in your code.

so, either you add a default constructor to your compAdd class, or you change the call to the constructor to something like this:

compAdd c1 = new compAdd("some String");

If you don't know java why are you starting with gui when you don't know even the basics of the language?
Start by writing simple console programs and learn how to use classes, extending them . . .

commented: Exactly +3

If you don't know java why are you starting with gui when you don't know even the basics of the language?
Start by writing simple console programs and learn how to use classes, extending them . . .

Exactly when you are learning to Swim, you just don't directly jump into the middle of the ocean, you start in the baby pool first.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.