Created
May 16, 2013 01:10
-
-
Save azenla/5588698 to your computer and use it in GitHub Desktop.
GroovyPower Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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