Last active
August 29, 2015 14:27
-
-
Save zkxs/d5cde333225af88e4b7d to your computer and use it in GitHub Desktop.
Double Brace Initialization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Braces { | |
public static void main(String[] args) { | |
List<String> list = new ArrayList<String>(){{ | |
add("michael"); | |
add("was"); | |
add("here"); | |
}}; | |
for (String s : list) { | |
System.out.print(s + " "); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment