Difference between revisions of "Array initialization"
Jump to navigation
Jump to search
Richardnoe (talk | contribs) (clean up) |
m (Reverted edits by Richardnoe (talk) to last revision by Ed Poor) |
||
| Line 15: | Line 15: | ||
[[Category:Computer Programming]] | [[Category:Computer Programming]] | ||
| − | |||
| − | |||
Revision as of 01:01, September 15, 2011
Array initialization is done differently, depending on the computer programming language being used. Java borrows the curly brace syntax of C++ as follows:
int[] temp = {-40, 0, 20, 100};
Javascript is similar, but uses square brackets:
var temp = [-40, 32, 68, 212];
Or the new keyword:
days = new Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");