Skip to content

Instantly share code, notes, and snippets.

@devDeejay
Created September 19, 2018 03:53
Show Gist options
  • Select an option

  • Save devDeejay/2be237060d782a0c96f6b0728198de6c to your computer and use it in GitHub Desktop.

Select an option

Save devDeejay/2be237060d782a0c96f6b0728198de6c to your computer and use it in GitHub Desktop.
import java.util.Arrays;
import java.util.List;
public class Demo {
public static void main(String[] args) {
String[] array = {"Hello", "World"};
List<String> list = Arrays.asList(array);
for (String s : list) {
System.out.println(s);
}
System.out.println("=======");
array[0] = "Yo";
for (String s : list) {
System.out.println(s);
}
/**
* Generates The Following Output (Ignore The '*')
* Hello
* World
* =======
* Yo
* World
*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment