Why do I get “Exception; must be caught or declared to be thrown” when I try to compile my Java code?

后端 未结 6 766
粉色の甜心
粉色の甜心 2020-11-22 08:46

Consider:

import java.awt.*;

import javax.swing.*;
import java.awt.event.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import java.security.*;
impor         


        
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 09:29

    In your 'encrypt' method, you should either get rid of the try/catch and instead add a try/catch around where you call encrypt (inside 'actionPerformed') or return null inside the catch within encrypt (that's the second error.

提交回复
热议问题