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 at numericalComputatio.fibo.main(fibo.java:30) package numericalComputatio; public class fibo { static double c = -0.618; // double c = [(1-sqrt(5))/2] = - 0.618 /** * Computes the fibonacci series * @param n * @return */ private static double fibo(int n){ if (n == 0) return 1; else if (n == 1) return c; else { double result = fibo(n - 1) + fibo(n - 2); return result; } } public static void main(String[] args) { int n = 0; double result = 0.0; double result1 = 1.000000000; if (args[0] != null)
Related Posts:
- Is there a way to convert all comments into javadoc comments? [Eclipse/Java]
- Reverse a string in Java
- “Char cannot be dereferenced” error
- Explanation on Integer.MAX_VALUE and Integer.MIN_VALUE to find min and max value in an array
- How to check if a String contains another String in a case insensitive manner in Java?
- Failed to write core dump. minidumps are not enabled by default on client version of windows
- How do I resolve ClassNotFoundException?
- Non-static variable cannot be referenced from a static context
- SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”
- “Missing return statement” within if / for / while
- How to convert byte array to string and vice versa?
- good example of Javadoc
- How do popBackStack() and replace() operations differ?
- Can’t find mysqladmin on Mac OSX 10.6.8
- What is an AssertionError? In which case should I throw it from my own code?
- How to write a Unit Test?
- Best way to Format a Double value to 2 Decimal places
- Collision resolution in Java HashMap
- “Content is not allowed in prolog” when parsing perfectly valid XML on GAE
- Java Undefined Object
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- How to convert an ArrayList containing Integers to primitive int array?
- Left Hand Side of an Assignment must be a Variable CharAt
- Compiling a java program into an executable
- Java Installation Not Completed / Unable to install Java
- Convert an integer to an array of characters : java
- How to compare dates in Java?
- Java integer-double division confusion
- What is Java String interning?
- What condition does while(true) test? When is it true and false?
- What is the significance of log4j.rootLogger property in log4j.properties file? What happens if I don’t use this property?
- “Instantiating” a List in Java? [duplicate]
- HTTP Status 405 – Request method ‘POST’ not supported (Spring MVC)
- Missing `server’ JVM (Java\jre7\bin\server\jvm.dll.)
- Convert String array to ArrayList
- java uses or overrides a deprecated API error
- What is setBounds and how do I use it?
- Exception in thread “main” java.lang.NumberFormatException: For input string: “S”
- Invalid character constant in java
- How to pass a function as a parameter in Java?
- ResultSet exception – before start of result set
- The activity must be exported or contain an intent-filter
- How to set JAVA_HOME environment variable on Mac OS X 10.9?
- Remove last character of a StringBuilder?
- Why SpringMVC Request method ‘GET’ not supported?
- Error: JAVA_HOME is not defined correctly executing maven
- Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory
- Android – SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
- How to sort an array of objects in Java?
- The specified child already has a parent. You must call removeView() on the child’s parent first (Android)
- HTTP Status 500 Error instantiating servlet class
- How to convert the following json string to java object?
- Java end of file
- A KeyValuePair in Java
- Unclosed Character Literal error
- Java error: void cannot be converted to String
- CreateProcess error=2, The system cannot find the file specified
- Add String Array to ArrayList
- Java Array Sort descending?
- The import javafx cannot be resolved
- Java Copy Constructor ArrayLists
- Implementing an actionlistener to a JTextField
- StringIndexOutOfBoundsException String index out of range: 0
- Cannot resolve method in java
- How to take input as String with spaces in java using scanner
- Address already in use: JVM_Bind java
- java.lang.ClassNotFoundException:com.mysql.jdbc.Driver [duplicate]
- How can I check if a value is of type Integer?
- Using regex to match any character except =
- Why is a ConcurrentModificationException thrown and how to debug it
- How to sort a HashSet?
- Variable used in lambda expression should be final or effectively final
- Populate int array with for loop in Java
- calling boolean method, heads or tails
- Android Color Picker
- How to fix an UnsatisfiedLinkError (Can’t find dependent libraries) in a JNI project
- How to Delete a topic in apache kafka [duplicate]
- Java Main Game Loop
- “Integer number too large” error message for 600851475143
- How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
- JPA or JDBC, how are they different?
- Adding JPanel to JFrame
- Append a single character to a string or char array in java?
- Java printf formatting to print items in a table or columns
- How to resolve “Syntax error on token “else”” in Java?
- What’s the difference between Jetty and Netty?
- Is there a way to simulate the C++ ‘friend’ concept in Java?
- Good way to encapsulate Integer.parseInt()
- What is the difference between “Double” and “double” in Java?
- What is the purpose of the default keyword in Java?
- What exactly is Ajax request? Is it different from Servlet Request?
- java ‘jar’ is not recognized as an internal or external command
- A JRE or JDK must be available in order to run Eclipse. No JVM was found after searching the following locations
- In Java, how do I parse XML as a String instead of a file?
- Java Returning method which returns arraylist?
- String cannot be resolved to a type – Java RAD
- IntelliJ IDEA “The selected directory is not a valid home for JDK”
- Simple timeout in java
- Eclipse message saying List cannot be resolved to a type
- Can’t seem to disable Java Automatic Update