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);
}
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);
}
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);
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us