How to program arrays in Java
Not what you're looking for?
If you were explaining an array ti a friend who is learning Java. how would you do so?
How would you explain how arrays are used?
Provide at least one concrete example.
Purchase this Solution
Solution Summary
How arrays are used in Java is explained.
Solution Preview
You can store Java program data in variables. Each variable has:
- An identifier,
- A type, and
- A scope.
When you have closely related data of the same type and scope, it is often convenient to store it together in a data structure instead of in individual variables. The most common data structure is the array. Arrays are fixed-length structures for storing multiple values of the same type. An array implicitly extends java.lang.Object so an array is an instance of Object. But arrays are directly supported language features. This means that their performance is on par with primitives and that they have a unique syntax that is different than objects.
Array elements:
0 1 2
-----------------------
|1st | 2nd | 3rd |
-----------------------
* Structure of Java Arrays
The Java array depicted above has 3 elements. Each element in an array holds a distinct value. In the figure, the number above each element shows that element's index. Elements are always referenced by their indices. The ...
Purchase this Solution
Free BrainMass Quizzes
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.
C# variables and classes
This quiz contains questions about C# classes and variables.
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
Basic Networking Questions
This quiz consists of some basic networking questions.