Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java Programming: From the Ground Up

Similar presentations


Presentation on theme: "Java Programming: From the Ground Up"— Presentation transcript:

1 Java Programming: From the Ground Up
Chapter 1 An Introduction to Computers and Java Slides produced by Antonio Martinez

2 What is a Computer? A computer is a machine that performs computations, logical operations, or more generally, data manipulation according to some prescribed sequence of instructions called a computer program. The physical components of a computer are termed hardware and the programs software.

3 The Hardware The major hardware components:
The central processing unit (CPU)‏ Primary or random access memory (RAM)‏ Secondary or long term memory Input and output devices (I/O devices)‏

4 The Central Processing Unit
The CPU does: the computing the processing the bulk of the work Important components of the CPU: arithmetic and logic unit (ALU)‏ control unit (CU)‏ clock

5 The Central Processing Unit
The ALU performs calculations, billions per second The CU controls or coordinates which calculations the ALU performs The CPU clock determines how frequently the computer hardware executes instructions. A system’s hardware components are synchronized with the clock. Every time the clock ticks, another hardware action occurs.

6 Primary or Random Access Memory
How Data is Stored binary format a sequence of 0’s and 1's called bits. ASCII encoding: ‘a’ is represented by ‘b’ is encoded as A sequence of eight bits is called a byte.

7 Where Data is Stored When the CPU executes a program, the program instructions, along with relevant data, are stored in primary memory. Primary memory is also known as random access memory (RAM) because data may be retrieved or accessed in random, rather than sequential, order.

8 Where Data Is Stored You can conceptualize RAM as a collection of storage cells or boxes, each capable of holding just a single byte of information. A unique number, or memory address, identifies each such storage cell.

9 Secondary Memory Long term Permanent storage Secondary memory devices:
hard disks tapes CDs flash memory sticks.

10 Secondary Memory The programs that you use every day such as word processors, spreadsheets, and games are permanently stored on secondary storage devices. Compared to RAM, secondary memory is, in general, cheaper (per bit), slower, larger, electromechanical rather than electronic, and persistent: secondary memory devices do not lose their values when you turn off the computer.

11 Input/Output Devices Standard input devices: Output devices: keyboards
mouses joysticks stylus pens cameras microphones Output devices: monitors printers speakers

12 The Software The programs that run on a computer are collectively known as software. Word processors, internet browsers, editors, database management systems, computer games, and spreadsheets are all part of your computer's software library. When you turn on or boot your computer, a program called the operating system automatically runs. This special program provides an interface between you and your computer.

13 Machine Language Each CPU executes instructions encoded in its own unique native machine language. A hypothetical instruction for adding one number to another might have the form:

14 Machine Language In the 1960s, the first high-level language, FORTRAN, was invented and no longer were programmers forced to devise programs with binary instructions. FORTRAN instructions use an English-like syntax. Today, hundreds of high-level languages are available, with dozens in mainstream use, including: Fortran 2003, COBOL, Lisp, Visual BASIC, C, C++, C#, Java, Perl, Python, PHP, and Javascript.

15 Machine Language A typical instruction coded in a high-level language:
if income > then print "You are rich!"

16 The Compiler The program must be translated into the machine language of that computer. Accepts a program written in a high-level language and produces a translation into the target machine language.

17 Java General-purpose language developed by Sun Microsystems in the early 1990s. Three main goals for their new language: Platform Independence - Java programs should be capable of running on any computer. Security - Java programs should not be susceptible to hackers' code and dangerous viruses. Reliability - Java programs should not "crash.”

18 The Java Virtual Machine
In order to make Java a cross-platform programming language, Java's creative team designed an abstract computer implemented in software called the Java Virtual Machine (JVM). You install software on your computer that simulates a JVM computer. The machine language of the JVM is called bytecode. Java programs are first compiled into bytecode, and then executed.

19 The Java Virtual Machine
The Java interpreter, which is part of the JVM, executes each bytecode instruction, one by one. Once a Java program is translated into bytecode, the bytecode can run on any computer that has installed the JVM. A Java program needs to be compiled into bytecode just once.

20 Programming and Algorithms
An algorithm is a finite, step-by-step procedure for accomplishing some task or solving a problem. The study of algorithms is a cornerstone of computer science. A programming language is your tool, a tool that you can use to investigate and implement algorithms.


Download ppt "Java Programming: From the Ground Up"

Similar presentations


Ads by Google