Here is my code so far:
import java.util.ArrayList;
public class BasicArraylists0
{
public static void main(String[] args)
{
ArrayList arrayList = new ArrayList();
arrayList.add(-113);
arrayList.add(-113);
System.out.println(arrayList); // prints [-113, -113]
}
}
I want to code so that it prints values, -113s in this case, and index without any brackets without using any for or while loop?
For example, I would like to print something like
"Slot 0 has a -113" "Slot 1 has a -113" and so on.
Aucun commentaire:
Enregistrer un commentaire