Advertisement
Guest User

valeh petuwaraaaa

a guest
Nov 30th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. package javaapplication1;
  2.  
  3. import java.io.BufferedWriter;
  4. import java.io.FileNotFoundException;
  5. import java.io.FileWriter;
  6. import java.util.InputMismatchException;
  7. import java.util.Scanner;
  8.  
  9. public class JavaApplication1 {
  10. public static void main(String[] args)
  11. {
  12. try
  13. {
  14. Scanner in = new Scanner(System.in);
  15. System.out.println("Please enter your age :");
  16. int age = in.nextInt();
  17. BufferedWriter bw = new BufferedWriter(new FileWriter("D;\\login.txt"));
  18. bw.append(String.valueOf(age));
  19. bw.close();
  20. }
  21. catch (InputMismatchException e)
  22. {
  23. System.out.println("Please enter the integer");
  24. }
  25. catch (FileNotFoundException e)
  26. {
  27. System.out.println("Please enter the integer");
  28. }
  29. catch (Exception e)
  30. {
  31. System.out.println("Please enter the integer");
  32. }
  33. ;
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement