160 likes | 168 Views
Learn the basics of computers and programming with Java, including hardware and software systems, programming languages, and the components of a program. Discover how to create applications and applets using Java.
E N D
Chapter 1 Introduction to Computers and Java
Topics • Introduction • Why Program? • Computers Systems: Hardware and Software • Programming Languages • What Is a Program Made of? • The Programming Process • Object-Oriented Programming
1. Introduction • Java is a powerful language that runs on practically every type of computer • Java can be used to create large applications or small programs, known as applets, that are part of a Web site
2. Why Program? • The computer can do such a wide variety of tasks because it can be programmed • Computers do whatever job their programs, or software, tell them to do • Programmers create software using programming languages such as Java because computers do not understand human languages
3. Computer Systems • All computer systems consist of similar hardware devices and software components • Hardware refers to physical components that a computer is made of • Software refers to programs that run on a computer. There are 2 general categories of software: operating systems and application software
Checkpoint • Why is the computer used by so many different people, in so many different professions? • List the 5 major hardware components of a computer systems? • The CPU consists of what 2 units • Describe the steps in the fetch/decode/execute cycle • What is a memory address? What is its purpose? • Why computers have both main memory and secondary storage • What does the term “multitasking” mean?
4. Programming Languages • A program is a set of instructions a computer follows in order to perform a task • These instructions are called an algorithm • A computer can only process instructions that are written in machine language look like: …1011010000000101… • Programming languages, which use words instead of numbers, and then translated into machine language by software
4. Programming Language: Java • Created in 1991 • Sun Microsystems • Original name: Oak • Byte code • Java Applications • Java applets
5. What is a program made of? • Common elements of a programming language: • Key words (reserved words) • Operators, operands • Punctuation • Programmer-defined Names (Identifiers) • Syntax
5. What is a program made of? • Lines: blank line, comments, statements • Variables • Source code, source file, .java extension • Compiler • Java Virtual Machine (JVM) • Java Software Editions (JDK, SDK) • Java SE • Java EE • Java ME
Checkpoint • Describe the difference between a keyword and a programmer-defined symbol. • Describe the difference between operators and punctuation symbols. • Describe the difference between a program line and a statement. • What is a variable? • What happens to a variable’s contents when a new value is stored there? • What is a compiler? • What is a syntax error? • What is byte code? • What is the JVM?
6. The programming process • Clearly define what the program is to do (4 items) • Visualize the program running on the computer • Use design tools to create a model of the program • Check the model for logical errors • Write the code and compile • Correct compile errors during compilation • Run the program • Correct runtime errors • Validate the results
Checkpoint • What 4 items should you identify when defining what a program is to do? • What does it mean to “visualize a program running”? • What is pseudocode? • Describe what a compiler does with a program’s source code? • What is a runtime error? • Is a syntax error found by the compiler or when the program is running? • What is the purpose of testing a program with sample data or input?
Find correct answer • The part of computer that fetches instructions, carries out the operations commanded by the instructions, and produces outcome. • A byte is made of eight _______. • Each byte is assigned a unique _______. • A type of memory that can hold data for long periods of time.
Find correct answer • The type of program that can run in a Web browser. • The words that have a special meaning in the programming language. • Symbols or words that perform operations on one or more operands. • Characters that serve specific purpose, such as marking the beginning or the end of a statement, or separating items in a list.
Find correct answer • The rules that must be followed when writing a program. • A named storage location in the computer’s memory. • The Java compiler generates _____. • JVM stands for ________.