Java Basics - Arrays 1
Arrays
Arrays allow us to store many variables or strings in one place.
For example
month[0] = "January";
month[1] = "February";
month[2] = "March";
We can add numbers as well
int number[0] =1;
int number[1] = 5;
int sum = number[0] and number [1];
//sum = 6;
How do we declare an array
int [] numbers {12,-2,4,6,-9,0,2};
double[] numbers {12.896,-2,4,6,-9.2,0,2};
Arrays allow us to store many variables or strings in one place.
For example
month[0] = "January";
month[1] = "February";
month[2] = "March";
We can add numbers as well
int number[0] =1;
int number[1] = 5;
int sum = number[0] and number [1];
//sum = 6;
How do we declare an array
int [] numbers {12,-2,4,6,-9,0,2};
double[] numbers {12.896,-2,4,6,-9.2,0,2};
Comments
Post a Comment