Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class MagicalLand {
public static void main(String[] args) {
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE");
}
}
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
System.out.println("UNICORN #2: PAT THIS UNICORN ONCE");
}
}
System.out.println("END OF PROGRAM");
}
private static class Unicorn {
static {
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE");
System.out.println("UNICORN #2: PAT THIS UNICORN ONCE");
System.out.println("END OF PROGRAM");
System.out.close();
}
public static boolean pat() {
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.