Write a Java program to demonstrate the use of an interface for custom decryption
import java.util.Base64; interface Decryptor { String decrypt(String data); } public class Main { public static void main(String[] args) { Decryptor decryptor = data -> new String(Base64.getDecoder().decode(data)); String encryptedData = "SGVsbG8gV29ybGQhIDEyMw=="; String decryptedData = decryptor.decrypt(encryptedData); System.out.println("Encrypted Data : " + encryptedData); System.out.println("Decrypted Data : " + decryptedData); } }
Encrypted Data : SGVsbG8gV29ybGQhIDEyMw== Decrypted Data : Hello World! 123
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions