In the beginning, Java was really just a single program that was shared among a handful of people in a company working on a single platform. The first person to come up with a new idea that was going to be incorporated into the platform would be the first to be the first to be given the credit and the responsibility for the new idea. I remember this and I am grateful for it.
Now, it’s become a whole industry that is a constant source of innovation. So many great new ideas came out of Java and the people who worked with Java. Even though most of these new ideas didn’t work out, they did have a lasting effect on the industry.
I have a feeling that many of you may not know that this is a very long-lasting effect. While I’ve been a little bit more patient with people with some of the worst mindsets, I think we are going to be talking a lot more about this than we normally do.
So let’s talk about a very little known aspect of Java. This is how we use arrays.
You may know them from Java. But do you know what they are? They are arrays.
So let’s take a look at an example. A list of integers, a list of colors, or a list of characters. They all have the same structure with each element being an integer or a color or a character. In Java the list of integers is called an array. The list of colors is called a map.The list of characters is called a list. These are called variables because they are used to store information.
What I love about Java is that it manages to use the same word for all three. This is an important concept that makes the programming language so useful. It makes the language so easy to learn.
In Java, variables are a little bit more like a bag of chips. They are the building blocks of the program, but they are not that important. They are used to store information, but once that information is there in the variables, they don’t need to be used. Java’s variable names are very descriptive. This makes coding easier. I love the fact that you know what an array is and what a map is, but I don’t really need to know what an int is.
You dont really need to know what an array is, but it is important because Java does not have dynamic memory allocation (like C++, for example). When you use dynamic memory allocation, you allocate a chunk of memory by specifying a size, and then this chunk of memory is used to store the information you have to store. In Java, all you do is tell the compiler to allocate enough memory for the information, and the compiler makes sure that you know what to expect.
What you get in Java is not a chunk of memory, but a complete array of objects. For example, if you have an array of four integers, the two numbers you store in your array would be the first two integers in the array.