Hi, i am working on a project for school, i need to create a dynamic array that will expand as data is added to it. I am trying to get the Fibonacci series added to the list. here is my code:
Code:
import java.util.*;
class fibo
{
public static void main(String[]args)
{
ArrayList numbers =new ArrayList();
numbers.size();
numbers.add(0);
numbers.add(1);
{
for(int x=2; x<20; x++;)
{
ArrayList numbers(x)=numbers(x-2)+numbers(x-1);
System.out.println(numbers(x));
}}}}
I was wondering if any one would help....