java - How to remove a string from an arraylist randomly -


so program supposed user inputs name text box , presses button add array displayed onto text area. thing can't figure out how take away name arraylist randomly. noob programmer.

here have far.

 random r = new random();  arraylist <string> names = new arraylist<string>();   private void btnaddactionperformed(java.awt.event.actionevent evt) {                                             names.add(txtadd.gettext());     txtdisplay.settext("" + names);  }       

names.remove(r.nextint(names.size()));


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -