java - Print out certain elements in a list -


i have list of strings (list collection) question how print out first string,

linkedlist<string> list = new linkedlist<string>();         list.add("octopus");         list.add("fish");         list.add("shark"); 

to print out first item in list do:

system.out.println(list.get(0)); 

the .get(0); gets string @ index 0. lists start @ 0, first value in list @ index 0.

java docs .get(index) linkedlist.


Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -