Comme indiqué ci-dessous:
Importer java.util.list; import java.util.arraylist; import java.util.set; import java.util.hashset; classe publique lzwcode {public static void main (String [] args) {testa (); System.out.println("========================================================================================== ============================================================================================================================. ============================================================================================================================. =============================================================================================================================. statique void testa () {String [] str = {"java", "c ++", "php", "c #", "python", "c ++", "java"}; i ++) {if (! System.out.println (); String [] newstr = list.toArray (New String [1]); } System.out.println (); } // Supprimer l'un des éléments du tableau public static void testB () {string [] str = {"java", "c ++", "php", "c #", "python"}; for (String elementa: str) {System.out.print (élémenta + ""); } // delete php list <string> list = new ArrayList <string> (); for (int i = 0; i <str.length; i ++) {list.add (str [i]); } list.remove (2); //list.remove("php ") System.out.println (); String [] newstr = list.toArray (new String [1]); // renvoie un tableau de types spécifiés contenant tous les objets pour (String ElementB: newstr) {System.out.print (élémentB + ""); } System.out.println (); } // Ajouter un élément dans le tableau public static void testc () {string [] str = {"java", "c ++", "php", "c #", "python"}; for (String elementa: str) {System.out.print (élémenta + ""); } // Ajouter Ruby List <string> list = new ArrayList <string> (); for (int i = 0; i <str.length; i ++) {list.add (str [i]); } list.add (2, "Ruby"); //list.add("ruby ") System.out.println (); String [] newstr = list.toArray (new String [1]); // renvoie un tableau de types spécifiés contenant tous les objets pour (String ElementB: newstr) {System.out.print (élémentB + ""); } System.out.println (); }}Résultats de la console:
Ce qui précède est le tableau Java qui vous a été apporté par l'éditeur. Les méthodes pour supprimer les valeurs en double, augmenter et supprimer les éléments du tableau sont toutes incluses. J'espère que tout le monde prend en charge wulin.com ~