Chapter 1 Introduction to Computers,(D Programs, and Java Prerequisites for Part I asic computer skills such as using Windows Internet Explorer, and Microsoft Word Chapter 1 Introduction to Computers, Programs and Java Chapter 2 Primitive Data Types and Operations Chapter 3 Control Statements hapter 4 Methods Chapter 5Arrays Liang Introduction to Java Programming, revised by Dai-kaiyu
Liang, Introduction to Java Programming,revised by Dai-kaiyu 1 Chapter 1 Introduction to Computers, Programs, and Java Chapter 1 Introduction to Computers, Programs, and Java Chapter 2 Primitive Data Types and Operations Chapter 3 Control Statements Chapter 5 Arrays Chapter 4 Methods Basic computer skills such as using Windows, Internet Explorer, and Microsoft Word Prerequisites for Part I
Objectives To review computer basics. programs and operating systems §1.2-14) o To represent numbers in binary, decimal, and hexadecimal(8 1.5 Optional o To understand the relationship between Java and the World wide Web(§16) o To know Java's advantages(8 1.7) o To distinguish the terms aPl, IDE, and JDK(8.8) o To write a simple Java program(8 1.9) o To create, compile, and run Java programs(s 1.10) o To understand the Java runtime environment($ 1.10) o To know the basic syntax of a Java program (81.11) o To display output on the console and on the dialog box (s 1. 12) Liang, Introduction to Java Programming, revised by Dai-kaiyu
Liang, Introduction to Java Programming,revised by Dai-kaiyu 2 Objectives l To review computer basics, programs, and operating systems (§1.2-1.4). l To represent numbers in binary, decimal, and hexadecimal (§1.5 Optional). l To understand the relationship between Java and the World Wide Web (§1.6). l To know Java’s advantages (§1.7). l To distinguish the terms API, IDE, and JDK (§1.8). l To write a simple Java program (§1.9). l To create, compile, and run Java programs (§1.10). l To understand the Java runtime environment (§1.10). l To know the basic syntax of a Java program (§1.11). l To display output on the console and on the dialog box (§1.12)
What Is a Computer? ● Computer O Performs computations and makes logical decisions O Millions /billions times faster than human beings ● Computer programs O Sets of instructions for which computer processes data ● Hardware O Physical devices of computer system Software O Programs that run on computers Liang, Introduction to Java Programming, revised by Dai-kaiyu
Liang, Introduction to Java Programming,revised by Dai-kaiyu 3 What Is a Computer? lComputer ¡Performs computations and makes logical decisions ¡Millions / billions times faster than human beings lComputer programs ¡Sets of instructions for which computer processes data lHardware ¡Physical devices of computer system lSoftware ¡Programs that run on computers
Computer organization o Six logical units of computer system O Central processing unit(CPU o Supervises operation of other devices o two components Control unit Arithmetic and logic unit (ALU) O Memory unit o RAMRamdom-access memory) Ostorage devices o Hard drives, floppy drives INput and output Devices iNput unit ● Mouse, keyboard ● Output unit o Printer, monitor, audio speakers
Liang, Introduction to Java Programming,revised by Dai-kaiyu 4 Computer Organization l Six logical units of computer system ¡Central processing unit (CPU) l Supervises operation of other devices l Two components: • Control Unit • Arithmetic and logic unit (ALU) ¡Memory unit l RAM(Ramdom-access memory) ¡storage Devices l Hard drives, floppy drives ¡Input and output Devices lInput unit l Mouse, keyboard lOutput unit l Printer, monitor, audio speakers
What is a Computer A computer consists of a CPU, memory, hard disk, floppy disk monitor, printer, and communication devices Memo Disk, CD, and St torage Input Keyboard Tape Devices Devices Mouse CPU Modem and Communication Output Monitor, NIC Devices Devices Printer
Liang, Introduction to Java Programming,revised by Dai-kaiyu 5 What is a Computer? A computer consists of a CPU, memory, hard disk, floppy disk, monitor, printer, and communication devices. Memory CPU Storage Devices Disk, CD, and Tape Input Devices Output Devices Keyboard, Mouse Monitor, Printer Communication Devices Modem, and NIC
CPU >The central processing unit(CPU) is the brain of a computer >retrieves instructions from memory and executes them measured in megahertz(MHz), with 1 megahertz equaling million pulses per second. 1 gigahertz is 1000 megahertz Liang, Introduction to Java Programming, revised by Dai-kaiyu
Liang, Introduction to Java Programming,revised by Dai-kaiyu 6 CPU ØThe central processing unit (CPU) is the brain of a computer Øretrieves instructions from memory and executes them. Ø measured in megahertz (MHz), with 1 megahertz equaling 1 million pulses per second. 1 gigahertz is 1000 megahertz
emory >Memory is to store data and program instructions for CPu to execute a program and its data must be brought to memory before they can be executed >A memory unit is an ordered sequence of bytes, each holds eight bits 斗时 Liang, Introduction to Java Programming, revised by dai-kaiyu
Liang, Introduction to Java Programming,revised by Dai-kaiyu 7 Memory ØMemory is to store data and program instructions for CPU to execute. A program and its data must be brought to memory before they can be executed. ØA memory unit is an ordered sequence of bytes, each holds eight bits
How Data is stored? Computers use zeros and ones The programmers need not to be concerned about the encoding and de d ecoding g of data M Meme ntent byte is the minimum storage unit Every byte has a unique address RAM(radom-access memory) 2000 01001010 Encoding for character"? 20010110001 2002 01110110 Encoding for character 20030110001 2004 00000011 Encoding for number 3
Liang, Introduction to Java Programming,revised by Dai-kaiyu 8 How Data is Stored? ØComputers use zeros and ones Ø The programmers need not to be concerned about the encoding and decoding of data Øbyte is the minimum storage unit. ØEvery byte has a unique address ØRAM(radom-access memory) . . . 2000 2001 2002 2003 2004 . . . 01001010 01100001 01110110 01100001 00000011 Memory address Memory content Encoding for character ‘J’ Encoding for character ‘a’ Encoding for character ‘v’ Encoding for character ‘a’ Encoding for number 3
Storage devices >Information in memory is lost when the power is off >three main types of storage devices >Disk drives (hard disks and floppy disks) >CD drives( CD-R and CD-RW) and lape drives Memory Disk, CD, and Storage Input Keyboard, T ape Devices Devices Mouse CPU Modem and CommunIcation Output Monitor NIC Devices Devices Printer Liang Introduction to Java Programming, revised by Dai-kaiyu
Liang, Introduction to Java Programming,revised by Dai-kaiyu 9 Storage Devices ØInformation in memory is lost when the power is off Øthree main types of storage devices: ØDisk drives (hard disks and floppy disks) ØCD drives (CD-R and CD-RW) Ø and Tape drives. Memory CPU Storage Devices Disk, CD, and Tape Input Devices Output Devices Keyboard, Mouse Monitor, Printer Communication Devices Modem, and NIC
Output Devices: Monitor The monitor displays information( text and graphics). The resolution and dot pitch determine the quality of the display The resolution specifies the number of pixels per square inch he higher the resolution, the sharper and clearer the image is The dot pitch is the amount of space between pixels. The smaller the dot pitch, the better the display Memory Disk. CD and Storage Keyboard Devices Devices Mouse CPU Modem, and Communication Output Monitor Devices Devices Printer
Liang, Introduction to Java Programming,revised by Dai-kaiyu 10 Output Devices: Monitor The monitor displays information (text and graphics). The resolution and dot pitch determine the quality of the display. Ø The resolution specifies the number of pixels per square inch. The higher the resolution, the sharper and clearer the image is. Ø The dot pitch is the amount of space between pixels. The smaller the dot pitch, the better the display. Memory CPU Storage Devices Disk, CD, and Tape Input Devices Output Devices Keyboard, Mouse Monitor, Printer Communication Devices Modem, and NIC