Bell and Parr Chapter 1

Download Report

Transcript Bell and Parr Chapter 1

th
4
Java for students
Edition
Pearson-Prentice Hall
by Douglas Bell and Mike Parr
The background to Java
Chapter 1
The History of Java
•
•
•
•
•
1950s FORTRAN, COBOL
1960s ALGOL 60, CPL, BCPL
1970s C, UNIX
1980s C++
1990s Java (Oak)
Main Features of Java
•
•
•
•
Code similar to C++
Designed for the Internet
Portable – can be run on any compiler
Java applets are written to be secure
– CERT has some advisories about Java
Applets)
• Sun allows for free downloads
• Browsers are free and Java enabled
What is a program?
• Instructions (see shampoo bottle)
• A recipe
• A musical score
A computer obeys instructions
•
•
•
•
Input/output data
Calculations
Graphics
Response to user input
Programmers select from a list
of possible instructions that
carry out a specific tasks
• Music – repeats possible, provides a
notation for composer where/when to do so
• Program sections may need to be repeated
and notation provides for that
• Subtasks – some recipes need tasks to be
done before main task may be completed
Java methods
• (subtasks) may be called by main method
or another method when needed
A program may consist of:
•
•
•
•
•
•
Sequences
Repetition
Selection
Methods
Ready-made objects
Objects you write yourself