Provide Java code to create and initialize an array of integers
Provide Java code to create and initialize an array of integers (Java
primitive int), floats or any other Java primitive type of your choice.
You pick the array name and length.
Demonstrate the use of at least one Array method such as length, or ArrayList method such as add, remove, sort, contains (for searching — does this array contain name “Rosa Parks,” for example).
Example: How you would determine the length of your array? Show this through a code example you create where you use the length member.
Respond to other student postings by compiling and testing and providing feedback on their code.
Purpose of this week’s work:
1. to prepare for our Test 3 (ArrayList)
2. to understand WHY we use objects and classes — how much easier our work is. We can use built-in functions/methods rather than having to write them all ourselves.
Recall: we can look up all methods in a class here — http://docs.oracle.com/javase/7/docs/api/
Then find ArrayList and Array under All Classes on the left.