Skip to content

Instantly share code, notes, and snippets.

@azenla
Created May 16, 2013 01:10
Show Gist options
  • Save azenla/5588698 to your computer and use it in GitHub Desktop.
Save azenla/5588698 to your computer and use it in GitHub Desktop.
GroovyPower Example
package jpower.groovy
class GroovyPower {
public static void main(String[] args) {
if (args.length<1) {
help();
System.exit(2);
}
println("Success!");
printSeconds();
}
public static void printSeconds() {
Thread thread = new Thread(new SecondsThread());
thread.start();
}
public static void help() {
println("Possible Arguments:");
println(" --help");
println(" --execute");
println(" --delete");
println(" --create");
}
static class SecondsThread implements Runnable {
public void run() {
int seconds = 0;
while (true) {
seconds++;
if (seconds>20) {
println("DONE!");
System.exit(0);
}
println(seconds);
Thread.sleep(1000);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment