How do I remove objects from an array in Java?

前端 未结 20 1813
Happy的楠姐
Happy的楠姐 2020-11-22 01:20

Given an array of n Objects, let\'s say it is an array of strings, and it has the following values:

foo[0] = \"a\";
foo[1]          


        
20条回答
  •  佛祖请我去吃肉
    2020-11-22 01:42

    My little contribution to this problem.

    public class DeleteElementFromArray {
    public static String foo[] = {"a","cc","a","dd"};
    public static String search = "a";
    
    
    public static void main(String[] args) {
        long stop = 0;
        long time = 0;
        long start = 0;
        System.out.println("Searched value in Array is: "+search);
        System.out.println("foo length before is: "+foo.length);
        for(int i=0;i
                                                            
提交回复
热议问题