I want to make an array that its length customized. Here is the code :
import java.util.Scanner;
public class ArrayInt
{
static Scanner input = new Scanner(System.in);
public static void main(String[] args)
{
int Arraynya[];
System.out.print("Input panjang Array: ");
int inputan = input.nextInt();
Arraynya = new int[inputan];
Arraynya data[] = new Arraynya[inputan];
for(int i=0;i<Arraynya.length;i++)
{
System.out.println("Input data ke "+(i+1)+" : ");
int isi = input.nextInt();
}
Arraynya[inputan] = isi;
System.out.println("Arraymu :"+Arraynya[inputan]);
}
}
But it show errors :
ArrayInt.java:15: error: cannot find symbol Arraynya data[] = new Arraynya[inputan]; symbol: class Arraynya location: class ArrayInt
ArrayInt.java:15: error: cannot find symbol Arraynya data[] = new Arraynya[inputan]; symbol: class Arraynya location: class ArrayInt
ArrayInt.java:23: error: cannot find symbol Arraynya[inputan] = isi; symbol: variable isi location: class ArrayInt
3 errors
How can i input customized Array and show it properly? Should i use ArrayList ?