Java Reference
In-Depth Information
inputtothecompiler,hastheextension.java.TheJavabytecodefilegener-
ated by the Javac compiler has the extension .class. It is the file with the
.class extension that is executed by the Java interpreter. In Chapter 3, you
willlearntocreateandrunaprogramusing theJavasoftwaredevelopment
tools.
Java Code
A program, in general terms, is a sequential set of instructions designed to
perform a specific task. In this sense, the set of instructions that must be
followedtostartupaparticularmodelofautomobilecouldbedescribedas
the start-up program for that vehicle. By the same token, a computer pro-
gramisasetoflogicalinstructionsthatmakesthecomputerperformaspe-
cific function.
For example, you may write a computer program to calculate the inter-
est that accrues when you invest a given amount of money, at a certain in-
terest rate for a specific period of time. Another program could be used to
tell a robot when it is time to recharge its batteries. A third one to help a
physician diagnose a childhood disease by examining the patient's symp-
toms. In all of these cases the program consists of a set of instructions
that perform conditional tests, follow a predictable path, and reach a pre-
dictable result. A set of haphazard instructions that lead to no predictable
end is not considered a program.
Communicating with an alien intelligence
Whenwewriteacomputerprogramwearecommunicatingwithanalienin-
telligence. A computer is a machine built of metal, silicon, and other com-
posite materials. It has no knowledge and no common sense. In a way, a
computer is no more than a tin can. If one-hundred years ago someone had
found you attempting to communicate and give orders to a tin can, you
would have probably been committed to a mental institution.
Our main difficulty is that the tin can never knows what you mean .A
human intelligence has accumulated considerable knowledge of the
world and of society at large. The set of instructions for a human to get
me a can of pop out of a vending machine can be rather simple:
“Joe, here is fifty cents, would you please get me a Pepsi?”
Joe, who has knowledge of the world, understands that he must walk
out of the room, open the necessary doors and walk up and down stairs,
reach the vending machine, wait in line if someone is using it, then place
the coins in the adequate slot, punch the Pepsi button, retrieve the can of
pop, and bring it back to me, again opening doors and walking up and
down stairs as necessary. Joe has knowledge of doors, of stairs, of money,
Search WWH ::




Custom Search