File tree Expand file tree Collapse file tree 2 files changed +3
-8
lines changed
Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -58,12 +58,6 @@ public static void main(String[] argv) {
5858 System .out .println (" [x] Requesting fib(30)" );
5959 response = fibonacciRpc .call ("30" );
6060 System .out .println (" [.] Got '" + response + "'" );
61- System .out .println (" [x] Requesting fib(-1)" );
62- response = fibonacciRpc .call ("-1" );
63- System .out .println (" [.] Got '" + response + "'" );
64- System .out .println (" [x] Requesting fib(a)" );
65- response = fibonacciRpc .call ("a" );
66- System .out .println (" [.] Got '" + response + "'" );
6761 }
6862 catch (Exception e ) {
6963 e .printStackTrace ();
Original file line number Diff line number Diff line change @@ -9,8 +9,9 @@ public class RPCServer {
99 private static final String RPC_QUEUE_NAME = "rpc_queue" ;
1010
1111 private static int fib (int n ) {
12- if (n > 1 ) return fib (n -1 ) + fib (n -2 );
13- else return n ;
12+ if (n ==0 ) return 0 ;
13+ if (n == 1 ) return 1 ;
14+ return fib (n -1 ) + fib (n -2 );
1415 }
1516
1617 public static void main (String [] argv ) {
You can’t perform that action at this time.
0 commit comments