I'm getting below error when creating object along with parameterized constructor.
Main.java:6: error: constructor Cipher in class Cipher cannot be applied to given types
Cipher cy = new Cipher(k); ^
required: no arguments
found: int
reason: actual and formal argument lists differ in length
Here is my files looks like
<b>Main.java</b>
public class Main {
public static void main(String []args){
int k=8;
Cipher cy = new Cipher(k);
String encrypted_msg = cy.encrypt(message);
String decrypted_msg = cy.decrypt(encrypted_msg);
view1.displayResult("Decrypted message: "+decrypted_msg);
}
}
<b>Cipher.java</b>
import java.util.*;
public class Cipher
{
private int key;
// Constructor
public void Cipher(int k)
{
key = k;
}// end Constructor
} // end class