Guest User

Untitled

a guest
Jan 16th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. public static void talkSmack() throws Exception {
  2. ArrayList<String> questions = new ArrayList<String>();
  3. ArrayList<String> ans = new ArrayList<String>();
  4. questions.add("Starting a band called 1023MB");
  5. ans.add("We'll never get a gig");
  6. questions.add("How did the hipster burn his tongue?");
  7. ans.add("He drank his coffee before it was cool");
  8. questions.add("What do you call someone with no body and a nose?");
  9. ans.add("Nobody Knows");
  10. questions.add("When I found out my toaster wasn't waterproof");
  11. ans.add("I was shocked");
  12. questions.add("What concert costs 45 cents?");
  13. ans.add("50 cent featuring nickelback");
  14. questions.add("How do you organize a party in space");
  15. ans.add("You planet");
  16. questions.add("How does moses make his tea");
  17. ans.add("Hebrews it");
  18. questions.add("Why did the can-crusher quit his job");
  19. ans.add("Because it was soda pressing");
  20.  
  21. try {
  22. File joke = new File("joke.txt");
  23. FileReader fr = new FileReader(joke);
  24. BufferedReader br = new BufferedReader(fr);
  25. int a = Integer.parseInt(br.readLine());
  26. System.err.println(ans.get(a));
  27. fr.close();
  28. joke.delete();
  29. } catch (Exception e) {
  30. int a = (int)(Math.random()*questions.size());
  31. System.err.println(questions.get(a));
  32. FileWriter fw = new FileWriter(new File("joke.txt"),true);
  33. fw.write(a+"\n");
  34. fw.close();
  35. }
  36.  
  37. }
Add Comment
Please, Sign In to add comment