Answers for "java remove at index"

0

how to delete character certain index in java

public static String charRemoveAt(String str, int p) {
return str.substring(0, p) + str.substring(p + 1);
}
Posted by: Guest on June-16-2021
0

ArrayList remove(int index) method in java

import java.util.ArrayList;
public class ArrayListRemoveIndexMethodExample
{
   public static void main(String[] args)
   {
      ArrayList<Integer> al = new ArrayList<Integer>(5);
      al.add(56);
      al.add(29);
      al.add(76);
      al.add(94);
      System.out.println("ArrayList size: " + al.size());
      for(Integer number : al)
      {
         System.out.println("Number: " + number);
      }
      // removing element at third position
      al.remove(2);
      System.out.println("ArrayList size after using remove(int index) method: " + al.size());
      // printing all elements in list
      for(Integer number : al)
      {
         System.out.println("Number: " + number);
      }
   }
}
Posted by: Guest on October-29-2020

Code answers related to "java remove at index"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language