<< Chapter < Page Chapter >> Page >

Loop

The process of repetitively examining each grocery item and processing it is commonly referred to as a loop . In the early days of programming, for a programming language named FORTRAN, this was referred to as a do loop .

An algorithm

The entire procedure is often referred to as an algorithm .

Modifying stored data

Sometimes during the day, the owner of the grocery store may come to you and say that he is going to increase the price of a can of Beans from 15 cents to 25 cents and asks you to take care of the change in price.

You write 25 on a slip of paper and put it in the compartment labeled Beans, being careful to remove and destroy the slip of paper that was previously in that compartment. For the rest of the day, the new price for Beans will be used in your calculations unless the ownerasks you to change it again.

Not a bad analogy

This is a pretty good analogy to how random access memory is actually used by a computer program.

Names versus addresses

As a programmer using a high-level language such as Java, you usually don't have to be concerned about the numeric addresses of the compartments.

You are able to think about them and refer to them in terms of their names. (Names are easier to remember than numeric addresses). However, deep inside the computer, these names are cross-referenced to addresses and at the lowest level, the program works with memory addresses instead of names.

Execute an algorithm

A computer program always executes some sort of procedure, which is often called an algorithm . The algorithm may be very simple as described in the checkout counter example described above, or it may be very complex as would be the case for a spreadsheet program. As the program executes its algorithm, it uses the random access memory to store and retrieve the data that is needed to execute thealgorithm.

Why is it called RAM?

The reason this kind of memory is called RAM or random access memory is that it can be accessed in any order.

Sequential memory

Some types of memory, such as a magnetic tape, must be accessed in sequential order. This means that to get a piece of data (the price of beans, for example) from deep inside the memory, it is necessary to start at the beginning and examine every piece of data until the correct one is found.

Combination random/sequential

Other types of memory, such as disks, provide a combination of sequential and random access. For example, the data on a disk is stored in tracks that form concentric circles on the disk. The tracks can be accessed in random order, but the data within a track must be accessed sequentially starting at a specific point on the track.

Sequential memory isn't very good for use by most computer programs because access to each particular piece of data is quite slow.

Sample program

Listing 1 shows a sample Java program that illustrates the use of memory for the storage and retrieval of data.

Listing 1 . Program named Memory01.
//File Memory01.java class Memory01 {public static void main(String[] args){int beans; beans = 25;System.out.println(beans); }//end main}//End Memory01 class

Questions & Answers

summarize halerambos & holbon
David Reply
the Three stages of Auguste Comte
Clementina Reply
what are agents of socialization
Antonio Reply
sociology of education
Nuhu Reply
definition of sociology of education
Nuhu
what is culture
Abdulrahim Reply
shared beliefs, values, and practices
AI-Robot
What are the two type of scientific method
ogunniran Reply
I'm willing to join you
Aceng Reply
what are the scientific method of sociology
Man
what is socialization
ogunniran Reply
the process wherein people come to understand societal norms and expectations, to accept society's beliefs, and to be aware of societal values
AI-Robot
scientific method in doing research
ogunniran
defimition of sickness in afica
Anita
Cosmology
ogunniran
Hmmm
ogunniran
list and explain the terms that found in society
REMMY Reply
list and explain the terms that found in society
Mukhtar
what are the agents of socialization
Antonio
Family Peer group Institution
Abdulwajud
I mean the definition
Antonio
ways of perceived deviance indifferent society
Naomi Reply
reasons of joining groups
SAM
to bring development to the nation at large
Hyellafiya
entails of consultative and consensus building from others
Gadama
World first Sociologist?
Abu
What is evolutionary model
Muhammad Reply
Evolution models refer to mathematical and computational representations of the processes involved in biological evolution. These models aim to simulate and understand how species change over time through mechanisms such as natural selection, genetic drift, and mutation. Evolutionary models can be u
faruk
what are the modern trends in religious behaviours
Selekeye Reply
what are social norms
Daniel Reply
shared standards of acceptable behavior by the group or appropriate behavior in a particular institution or those behaviors that are acceptable in a society
Lucius
that is how i understood it
Lucius
examples of societal norms
Diamond
Discuss the characteristics of the research located within positivist and the interpretivist paradigm
Tariro Reply
what is Industrialisation
Selekeye Reply
industrialization
Angelo
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with java. OpenStax CNX. Jun 29, 2016 Download for free at https://legacy.cnx.org/content/col11441/1.201
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with java' conversation and receive update notifications?

Ask