Skip to content

Instantly share code, notes, and snippets.

@jponge
Created December 9, 2011 15:06
Show Gist options
  • Save jponge/1451867 to your computer and use it in GitHub Desktop.
Save jponge/1451867 to your computer and use it in GitHub Desktop.
A "factorial" module
mkdir -p sources/fact/fact
mkdir modules
# edit the files!
javac -d modules -modulepath modules \
-sourcepath sources \
sources/fact/module-info.java \
sources/fact/fact/Factorial.java
package fact;
public class Factorial {
public static int factorial(int n) {
if (n <= 0) { return 1; }
else { return n * factorial(n - 1); }
}
}
module fact @1.0 { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment