iterate through list of strings in java code example
Example 1: iterate through a list
my_list = ["Hello", "World"]
for i in my_list:
print(i)
Example 2: how to loop through a list
List<int> list = new List<int> { 1, 2, 3, 4, 5 };
//For Loop
for (int i = 0; i < list.Count(); i++)
{ Console.WriteLine(list[i]); }
//For Each Loop
foreach (int item in list)
{ Console.WriteLine(item); }