The answer is in the picture below.
The processor has written a byte of data at location 7. The old contents of that location are lost. Main memory now looks like the picture.
When a program is running, it has a section of memory for the data it is using. Locations in that section can be changed as many times as the program needs. For example, if a program is adding up a list of numbers, the sum will be kept in main memory (probably using several bytes.) As new numbers are added to the sum, it will change and main memory will have to be changed, too.
Other sections of main memory might not change at all while a program is running. For example, the instructions that make up a program do not (usually) change as a program is running. The instructions of a running program are located in main memory, so those locations will not change.
When you write a program in Java (or most other languages) you do not need to keep track of memory locations and their contents. Part of the purpose of a programming language is to do these things automatically.
(Review Question:) Where are programs and data kept for long-term storage?