I was making a class of functions to be performed on complex numbers. When I create a new object I get the following error:
error: constructor ComplexNumbers in class ComplexNumbers cannot be applied to given types; ComplexNumbers c1 = new ComplexNumbers(real1, imaginary1); ^ required: no arguments found: int,int reason: actual and formal argument lists differ in length
error: constructor ComplexNumbers in class ComplexNumbers cannot be applied to given types; ComplexNumbers c2 = new ComplexNumbers(real2, imaginary2); ^ required: no arguments found: int,int reason: actual and formal argument lists differ in length
2 errors
Code from main
int real1 = s.nextInt();
int imaginary1 = s.nextInt();
int real2 = s.nextInt();
int imaginary2 = s.nextInt();
ComplexNumbers c1 = new ComplexNumbers(real1, imaginary1);
ComplexNumbers c2 = new ComplexNumbers(real2, imaginary2);
Constructor code
public void ComplexNumbers(int real, int imaginary){
this.real=real;
this.imaginary=imaginary;
return;
}
void.