Declare and fill a multi dimensional array in Java

This is one of those super simple things I wont use for ever and ever and then when it comes time to use it, I can never remember and have to look at the API again. It makes me angry that I don’t remember it and so it is here now and I (and others maybe) can remember with a click.  

Using a Java String array as an example, the declaration looks like:

 

String[][] myStr = {
{"col-0-row-0","col-1-row-0"},
{"col-0-row-0","col-1-row-0"}
};
Advertisements

About Jayson
Father, mountain biker, Software developer at a wire service, and also work with the IPTC (iptc.org)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: