HOW TO REMOVE THE SECOND LAST ELEMENT FROM THE ARRAY IN THE FOLLOWING CODE private void task3()
Fantastic news! We've Found the answer you've been seeking!
Question:
HOW TO REMOVE THE SECOND LAST ELEMENT FROM THE ARRAY IN THE FOLLOWING CODE
private void task3() { // code your task 3 here ArrayList myList = new ArrayList<>(10); //myList array list has been declared with a capacity // of 10 and integer data type myList.add(1); myList.add(7); myList.add(5); myList.add(3); myList.add(8); myList.add(10); myList.add(3, 11); //11 has been added in between 5 and 3, index 3 indicates the position // of the new element and element indicates 11 System.out.println(myList); System.out.println(myList.contains(7)); // print true if myList contains 7, false otherwise }
Related Book For
Posted Date: