main. java
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Arraylist1 integers = new Arraylist1(5);
integers.insertIntegers();
integers.displayIntegers();
}
}
Arraylist1.java
import javax.swing.*;
import java.util.*;
import java.io.*;
public class Arraylist1
{
Scanner s = new Scanner(System.in);
ArrayList<Integer> integers;
int totalIntegers;
public Arraylist1(int size)
{
totalIntegers = size;
integers = new ArrayList<Integer>();
}
public void insertIntegers()
{
for(int i = 0; i < totalIntegers; i++)
{
System.out.println("Enter numbers");
int numberss = s.nextInt();
integers.add(numberss);
}
}
public void displayIntegers()
{
System.out.println("Numbers: "+numberss);
}
}
please fix the error in there is the System.out.println("Numbers: "+numberss);
i dont know how to fix this problem
please help me
solved