Skip to content

Instantly share code, notes, and snippets.

@racecraftr
Created June 24, 2022 14:13
Show Gist options
  • Save racecraftr/7185c3d904e491fde2cf8a0b2e778152 to your computer and use it in GitHub Desktop.
Save racecraftr/7185c3d904e491fde2cf8a0b2e778152 to your computer and use it in GitHub Desktop.
Day 18 of the Useless Java series.
package UselessJava.Day18;
public class Day18 {
public String detectCosmicRay(){
final String[] comments = {"Why are you still here?",
"Most systems automatically fix errors caused by cosmic rays.",
"This is so stupid.",
"Based off of a reddit post by u/TripplerX.",
"I did nawt kill her, I did naaawt! Oh hai Mark.",
"The cheese stands alone, so sad :(",
"???",
"Why are we still here... just to suffer..."};
Thread t = new Thread(() -> {
while(true) {
try {
System.out.println(comments[(int) (Math.random() * comments.length)]);
Thread.sleep(3000);
}
catch(InterruptedException e) {
throw new RuntimeException(e);
}
}
}
);
t.start();
boolean b = true;
while (b){
}
t.interrupt();
return "Cosmic ray detected";
}
}
class Main{
public static void main(String[] args) {
Day18 d = new Day18();
System.out.println(d.detectCosmicRay());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment