Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. Scanner sc = new Scanner(System.in);
  2.  
  3. try{
  4. int i = sc.nextInt(); //user types: "dsadfasmfasdjasdlkasjldkajslkjlasdkjlkdasj"
  5. }
  6. catch(Exception e){
  7.  
  8. JOptionPane.showMessageDialog(formFrame, "You must enter a integer, not a string!");
  9.  
  10.  
  11.  
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement