When i tried running this code I get this error..I dont know where i went wrong..
Exception in thread \"main\" java.lang.ArrayIndexOutOfBoundsException: 0
args[0] will never be null (when invoked from the command line) - but args.length may be 0, in which case evaluating args[0] will give you that exception, because there is no element 0 in the array. Just test for that:
if (args.length != 0)
{
n = Integer.parseInt(args[0])
}
As an aside, it's pretty odd to return a double from fibo - the normal Fibonacci sequence is defined in terms of integers (0, 1, 1, 2, 3, 5, 8 etc). If you want to scale it, I'd multiply it by your constant afterwards.