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.
Comments
Post a Comment