Skip to content

Commit

Permalink
java/base
Browse files Browse the repository at this point in the history
  • Loading branch information
fasionchan committed Jul 20, 2019
1 parent 4e5e65e commit 005261d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/java/base/CommandLineArgs/CommandLineArgs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Author: fasion
* Created time: 2019-07-20 12:20:13
* Last Modified by: fasion
* Last Modified time: 2019-07-20 12:22:58
*/

public class CommandLineArgs {
public static void main(String args[]) {
for (int i=0; i<args.length; i++) {
System.out.printf("Args %d: `%s`\n", i, args[i]);
}
}
}
12 changes: 12 additions & 0 deletions src/java/base/HelloWorld/HelloWorld.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Author: fasion
* Created time: 2019-07-20 12:18:01
* Last Modified by: fasion
* Last Modified time: 2019-07-20 12:18:40
*/

public class HelloWorld {
public static void main(String args[]) {
System.out.println("Hello, world!");
}
}
20 changes: 20 additions & 0 deletions src/java/base/recursion/Fibonacci/Fibonacci.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Author: fasion
* Created time: 2019-07-20 12:02:52
* Last Modified by: fasion
* Last Modified time: 2019-07-20 12:16:29
*/

public class Fibonacci {
public static int fibonacci(int n) {
if (n==1 || n==2) {
return 1;
}
return Fibonacci.fibonacci(n-1) + Fibonacci.fibonacci(n-2);
}

public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
System.out.println(Fibonacci.fibonacci(n));
}
}

0 comments on commit 005261d

Please sign in to comment.