SlideShare a Scribd company logo
Ch 1 - Introduction to Computers and Programming
 Hardware Terminology
 Main Memory
 Auxiliary Memory
 Drives
 Writing Algorithms Using Pseudocode
 Programming Language Code
 The Compilation Process for Non-Java Programs
 Object Code
 Portability
 Java Virtual Machine
 The Compilation Process for Java Programs
 History of Java
1
Hardware Terminology
 Computer system = all of the components shown below.
2
Hardware Terminology
 I/O = input and output devices
 Input examples: keyboard,
mouse, scanner.
 Output examples: monitor
(screen), printer.
 CPU = the computer's "brain."
 Synonyms:

central processing unit
 processor

microprocessor
 popular CPUs:

Intel Core 2 Quad

Intel Core i7

AMD Phenom II

AMD Athlon 64
3
Main Memory
 When a computer performs
calculations, it often needs to
save intermediate results.
 It saves those intermediate
results in the main memory
storage area.
 Main memory is often called
RAM (Random Access
Memory).
 Memory contains storage boxes, and each storage box contains
a piece of information. For example, if a program stores the
word “Emu,” it uses six storage boxes: one for the first half of E,
one for the second half of E, one for the first half of m, one for
the second half of m, etc.
4
Main Memory
 Each of the six storage boxes used to store Emu
is a byte.
 Computers don't understand the alphabet. They
only understand 0’s and 1’s. So computers map
each alphabet character to a series of sixteen 0's
and 1's. For example, the letter E is 00000000
01000101. So in storing the letter E, main
memory actually stores 00000000 01000101.
Each of the 0's and 1's is called a bit. And each
of the eight-bit groupings is a byte.
 The capacity (size) of memory is described in
terms of number of bytes.
 RAM capacities in a typical computer range from
1 GB (gigabyte) to 8 GB.
 RAM is volatile – data is lost when power is
turned off.
Address
Memory
Contents
…
50,000
50,001
50,002
50,003
50,004
50,005
…
m
E
u
5
Auxiliary Memory
 Auxiliary memory is for saving
data permanently. It's non-
volatile.
 Auxiliary memory comes in
many different forms, the most
common of which are hard
disks, compact discs, and
USB flash drives. Those things
are called storage devices.
 Storage capacities:
 Typical hard disk: 160GB up to 1 TB (terabyte).
 Compact discs:

For CD-ROMs, CD-Rs, and CD-RWs: ≈ 700 MB (megabyte)

For DVDs, DVD-Rs, and DVD-RWs: 4.7 GB up to 8.5 GB
 Typical USB flash drives: 4 GB up to 64 GB.
6
Drives
 A drive is a mechanism that enables the computer
system to access (read from and write to) data on a
storage device. A disk drive is a drive for a hard disk,
CD-ROM, or diskette.
 When using your computer, you’ll sometimes need to
copy data from one place to another. To specify the
storage media on which the data resides, you’ll need
to use the storage media’s drive letter followed by a
colon.
 Diskette drives are referred to as A:.
 Hard disk drives are usually referred to as C: or D:
 CD-ROM drives are usually referred to as D: or E:
 USB flash drives are usually referred to as E: or F:
7
Common Computer-Hardware Vocabulary
 "Disk space" usually means the capacity/size of your
hard disk.
 "Memory" (said by itself) usually means main
memory/RAM.
 "Computer" (said by itself) usually refers to the big
box that contains the CPU, the main memory, and
the hard disk.
8
Writing Algorithms Using Pseudocode
 A program is a set of instructions that can be used to solve a
problem.
 The first step in writing a program is writing a draft of your
program where your focus is on the basic logic, not the specific
details. The draft should include instructions that are coherent and
logically correct, but there's no need to worry about missing minor
steps or misspelling words. Such a draft program is referred to as
an algorithm.
 For example, a cake recipe is an algorithm.
 Algorithms are written with pseudocode – similar to regular
programming code except that precise syntax (words, grammar,
punctuation) isn't required.
 Example:
Write an algorithm that finds the average miles per hour value for a given
car trip.
Sample input
starting location = 100 ending location = 200
starting time = 2:00 ending time = 4:00
9
Programming Language Code
 A programming language is a language that uses specially
defined words, grammar, and punctuation that a computer
understands.
 Some of the more popular programming languages are
VisualBasic, C++, and Java.
 Example:
Write Java code that finds the average miles per hour value for a given
car trip.
 Initially, programming language code might be harder for you to
understand than pseudocode.
 But after you gain experience with a programming language, you
may become so comfortable with it that you're able to skip the
algorithm pseudocode step and start coding with the programming
language directly.
 However, for larger programs, I recommend that you do not skip
the algorithm pseudocode step. Why?
10
The Compilation Process for Non-Java Programs
 After writing a program, you'll normally want to have a computer
perform the tasks specified by the program. Getting that to work
is normally a two-step process: 1) Perform a compile command,
2) Perform a run command.
 When you perform a compile command, you tell the computer to
translate the program's programming language instructions to a
binary format (all 0's and 1's). When you perform a run
command, you tell the computer to read the binary-format
instructions and perform the tasks specified by them.
 The computer contains a special program called a compiler
that's in charge of the compilation process. If you submit
programming language instructions to a compiler, the compiler
translates them into binary-format instructions. More formally, if
you submit source code to a compiler, the compiler compiles the
source code and produces object code as the result. Source
code is the formal term for programming language instructions.
Object code is the formal term for binary-format instructions.
11
The Compilation Process for Non-Java Programs
source code
(programming
language
instructions)
object code
(binary
instructions)
Programmers write this.
Computers run this.
Compilers compile
source code into
object code.
12
Object Code
 Object code is a set of binary-format instructions that can be
directly run by a computer to solve a problem. A binary-format
instruction is made up of all 0’s and 1’s, because computers
understand only 0’s and 1’s. Here's an example of an object-
code instruction:
0100001111101010
 This particular object-code instruction is referred to as a 16-bit
instruction because each of the 0’s and 1’s is a bit, and there are
16 of them.
 Each object-code instruction is in charge of only a simple
computer task. For example, an object-code instruction could
possibly be in charge of copying a single number from some
place in main memory to some place in the CPU.
 Programmers sometimes refer to object code as machine code.
Object code is called machine code because it's written in binary
and that's what a computer “machine” understands.
13
Portability
 A piece of software is portable if it can be used on many
different types of computers.
 Object code is not very portable. As you know, object code is
comprised of binary-format instructions. Those binary-format
instructions are intimately tied to a particular type of computer. If
you've got object code that was created on a type X computer,
then the object code can run only on a type X computer.
 The Java solution to improve portability:
 Java compilers don't compile all the way down to object code.
Instead, they compile down to bytecode, which possesses the best
features of both object code and source code:

Like object code, bytecode uses a format that works closely with
computer hardware, so it runs fast.

Like source code, bytecode is generic, so it can be run on any type of
computer.
14
Java Virtual Machine
 How can bytecode be run on any type of computer?
 As a Java program’s bytecode runs, the bytecode is
translated into object code by the computer's
bytecode interpreter program. The bytecode
interpreter program is known as the Java Virtual
Machine, or JVM for short. The next slide shows how
the JVM translates bytecode to object code. It also
shows how a Java compiler translates source code to
bytecode.
15
The Compilation Process for Java Programs
Java source
code
object code
Java compilers compile
source code into
bytecode.
bytecode
When a Java program is
run, the JVM translates
bytecode to object code.
16
History of Java
 In the early 1990's, putting intelligence into home appliances was
thought to be the next "hot" technology.
 Examples of intelligent home appliances:
 Coffee pots and lights that can be controlled by a computer's
programs.
 Televisions that can be controlled by an interactive television
device's programs.
 Anticipating a strong market for such things, Sun Microsystems
in 1991 funded a research project (code named Green) whose
goal was to develop software for intelligent home appliances.
 An intelligent home appliance's intelligence comes from its
embedded processor chips and the software that runs on the
processor chips.
 Appliance processor chips change often because engineers
continually find ways to make processor chips smaller, less
expensive, and more powerful.
 To handle the frequent turnover of new chips, appliance software
must be extremely portable.
17
History of Java
 Originally, Sun planned to use C++ for its home appliance
software, but they soon realized that C++ was less than ideal
because it wasn't portable enough and it relied too heavily on
hard-to-maintain things called pointers.
 Thus, rather than write C++ software and fight C++'s inherent
deficiencies, Sun decided to develop a whole new programming
language to handle its home appliance software needs.
 Their new language was originally named Oak (for the tree that
was outside project leader James Gosling's window), but it was
soon changed to Java.
 When the home appliance software work dried up, Java almost
died before being released.
 Fortunately for Java, the World Wide Web exploded in popularity
and Sun realized it could capitalize on that.
18
History of Java
 Web pages have to be very portable because they can be
downloaded onto any type of computer.
 What's the standard language used for Web pages?
 Java programs are very portable and they're better than HTML in
terms of providing user interaction capabilities.
 Java programs that are embedded in web pages are called
applets.
 Although applets still play a significant role in Java's current
success, some of the other types of Java programs have
surpassed applets in terms of popularity.
 In this course, we cover Standard Edition (SE) Java applications.
They are Java programs that run on a standard computer – a
desktop or a laptop, without the need of the Internet.
19

More Related Content

PPT
CISY 105 Chapter 1
PPTX
Lecture 1 introduction to_computersb(2)
PPTX
Computer and Programming
DOCX
First compailer written
PPT
Introduction To Computer and Java
PPT
Java™ (OOP) - Chapter 1: "Introduction to Computers, Programs, and Java"
DOC
What is a computer
CISY 105 Chapter 1
Lecture 1 introduction to_computersb(2)
Computer and Programming
First compailer written
Introduction To Computer and Java
Java™ (OOP) - Chapter 1: "Introduction to Computers, Programs, and Java"
What is a computer

What's hot (19)

PPTX
Assembly and Machine Code
PPTX
Introduction To Programming in Matlab
PPTX
PPT
intoduction to Computer programming java learn for more chapter contact salma...
PDF
Introduction to compiler development
DOCX
Cartilla en ingles
DOCX
Glossary of terms (assignment...)
DOCX
Trhe glossary
PPT
Tech Term Defination
PDF
Keyboards and Internationalization
PPTX
Assembly language
PPT
PPT
intro to c programming
PPTX
Assembly language programming
PPTX
Assembly Language
DOCX
A 101025201954-phpapp02
PPT
Compilers programmingembedded
PPTX
Enee114 01
PPT
My cool new Slideshow!
Assembly and Machine Code
Introduction To Programming in Matlab
intoduction to Computer programming java learn for more chapter contact salma...
Introduction to compiler development
Cartilla en ingles
Glossary of terms (assignment...)
Trhe glossary
Tech Term Defination
Keyboards and Internationalization
Assembly language
intro to c programming
Assembly language programming
Assembly Language
A 101025201954-phpapp02
Compilers programmingembedded
Enee114 01
My cool new Slideshow!
Ad

Similar to Itroduction about java (20)

PDF
Supplementary Reading 01 - Introduction to computers, programs and java.pdf
PDF
Chapter 01 Java Programming Basic Java IDE JAVA INTELLIEJ
PPTX
lecture Slides - Week 1.programming fundamentals
PPT
Compilers and interpreters
PPT
An overview of computers and programming languages
DOCX
Glossary
DOCX
Source vs object code
PPT
Lecture 2 - Introductory Concepts
PDF
Rrw02 Week 1 Assignment
PPTX
Computer_Programming_Fundamentals in cpp
DOCX
Glossary of terms (assignment...)
DOCX
MikroBasic
DOCX
MikroBasic
DOCX
MikroBasic
DOCX
MikroBasic
DOCX
MikroBasic
PPTX
Structure programming – Java Programming – Theory
PDF
Chapter1.pdf
PPT
Big Java Chapter 1
Supplementary Reading 01 - Introduction to computers, programs and java.pdf
Chapter 01 Java Programming Basic Java IDE JAVA INTELLIEJ
lecture Slides - Week 1.programming fundamentals
Compilers and interpreters
An overview of computers and programming languages
Glossary
Source vs object code
Lecture 2 - Introductory Concepts
Rrw02 Week 1 Assignment
Computer_Programming_Fundamentals in cpp
Glossary of terms (assignment...)
MikroBasic
MikroBasic
MikroBasic
MikroBasic
MikroBasic
Structure programming – Java Programming – Theory
Chapter1.pdf
Big Java Chapter 1
Ad

Recently uploaded (20)

PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Pharma ospi slides which help in ospi learning
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Institutional Correction lecture only . . .
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
01-Introduction-to-Information-Management.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
TR - Agricultural Crops Production NC III.pdf
Microbial disease of the cardiovascular and lymphatic systems
O5-L3 Freight Transport Ops (International) V1.pdf
human mycosis Human fungal infections are called human mycosis..pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
O7-L3 Supply Chain Operations - ICLT Program
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Cell Types and Its function , kingdom of life
Microbial diseases, their pathogenesis and prophylaxis
Final Presentation General Medicine 03-08-2024.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Pharma ospi slides which help in ospi learning
Supply Chain Operations Speaking Notes -ICLT Program
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Basic Mud Logging Guide for educational purpose
Institutional Correction lecture only . . .

Itroduction about java

  • 1. Ch 1 - Introduction to Computers and Programming  Hardware Terminology  Main Memory  Auxiliary Memory  Drives  Writing Algorithms Using Pseudocode  Programming Language Code  The Compilation Process for Non-Java Programs  Object Code  Portability  Java Virtual Machine  The Compilation Process for Java Programs  History of Java 1
  • 2. Hardware Terminology  Computer system = all of the components shown below. 2
  • 3. Hardware Terminology  I/O = input and output devices  Input examples: keyboard, mouse, scanner.  Output examples: monitor (screen), printer.  CPU = the computer's "brain."  Synonyms:  central processing unit  processor  microprocessor  popular CPUs:  Intel Core 2 Quad  Intel Core i7  AMD Phenom II  AMD Athlon 64 3
  • 4. Main Memory  When a computer performs calculations, it often needs to save intermediate results.  It saves those intermediate results in the main memory storage area.  Main memory is often called RAM (Random Access Memory).  Memory contains storage boxes, and each storage box contains a piece of information. For example, if a program stores the word “Emu,” it uses six storage boxes: one for the first half of E, one for the second half of E, one for the first half of m, one for the second half of m, etc. 4
  • 5. Main Memory  Each of the six storage boxes used to store Emu is a byte.  Computers don't understand the alphabet. They only understand 0’s and 1’s. So computers map each alphabet character to a series of sixteen 0's and 1's. For example, the letter E is 00000000 01000101. So in storing the letter E, main memory actually stores 00000000 01000101. Each of the 0's and 1's is called a bit. And each of the eight-bit groupings is a byte.  The capacity (size) of memory is described in terms of number of bytes.  RAM capacities in a typical computer range from 1 GB (gigabyte) to 8 GB.  RAM is volatile – data is lost when power is turned off. Address Memory Contents … 50,000 50,001 50,002 50,003 50,004 50,005 … m E u 5
  • 6. Auxiliary Memory  Auxiliary memory is for saving data permanently. It's non- volatile.  Auxiliary memory comes in many different forms, the most common of which are hard disks, compact discs, and USB flash drives. Those things are called storage devices.  Storage capacities:  Typical hard disk: 160GB up to 1 TB (terabyte).  Compact discs:  For CD-ROMs, CD-Rs, and CD-RWs: ≈ 700 MB (megabyte)  For DVDs, DVD-Rs, and DVD-RWs: 4.7 GB up to 8.5 GB  Typical USB flash drives: 4 GB up to 64 GB. 6
  • 7. Drives  A drive is a mechanism that enables the computer system to access (read from and write to) data on a storage device. A disk drive is a drive for a hard disk, CD-ROM, or diskette.  When using your computer, you’ll sometimes need to copy data from one place to another. To specify the storage media on which the data resides, you’ll need to use the storage media’s drive letter followed by a colon.  Diskette drives are referred to as A:.  Hard disk drives are usually referred to as C: or D:  CD-ROM drives are usually referred to as D: or E:  USB flash drives are usually referred to as E: or F: 7
  • 8. Common Computer-Hardware Vocabulary  "Disk space" usually means the capacity/size of your hard disk.  "Memory" (said by itself) usually means main memory/RAM.  "Computer" (said by itself) usually refers to the big box that contains the CPU, the main memory, and the hard disk. 8
  • 9. Writing Algorithms Using Pseudocode  A program is a set of instructions that can be used to solve a problem.  The first step in writing a program is writing a draft of your program where your focus is on the basic logic, not the specific details. The draft should include instructions that are coherent and logically correct, but there's no need to worry about missing minor steps or misspelling words. Such a draft program is referred to as an algorithm.  For example, a cake recipe is an algorithm.  Algorithms are written with pseudocode – similar to regular programming code except that precise syntax (words, grammar, punctuation) isn't required.  Example: Write an algorithm that finds the average miles per hour value for a given car trip. Sample input starting location = 100 ending location = 200 starting time = 2:00 ending time = 4:00 9
  • 10. Programming Language Code  A programming language is a language that uses specially defined words, grammar, and punctuation that a computer understands.  Some of the more popular programming languages are VisualBasic, C++, and Java.  Example: Write Java code that finds the average miles per hour value for a given car trip.  Initially, programming language code might be harder for you to understand than pseudocode.  But after you gain experience with a programming language, you may become so comfortable with it that you're able to skip the algorithm pseudocode step and start coding with the programming language directly.  However, for larger programs, I recommend that you do not skip the algorithm pseudocode step. Why? 10
  • 11. The Compilation Process for Non-Java Programs  After writing a program, you'll normally want to have a computer perform the tasks specified by the program. Getting that to work is normally a two-step process: 1) Perform a compile command, 2) Perform a run command.  When you perform a compile command, you tell the computer to translate the program's programming language instructions to a binary format (all 0's and 1's). When you perform a run command, you tell the computer to read the binary-format instructions and perform the tasks specified by them.  The computer contains a special program called a compiler that's in charge of the compilation process. If you submit programming language instructions to a compiler, the compiler translates them into binary-format instructions. More formally, if you submit source code to a compiler, the compiler compiles the source code and produces object code as the result. Source code is the formal term for programming language instructions. Object code is the formal term for binary-format instructions. 11
  • 12. The Compilation Process for Non-Java Programs source code (programming language instructions) object code (binary instructions) Programmers write this. Computers run this. Compilers compile source code into object code. 12
  • 13. Object Code  Object code is a set of binary-format instructions that can be directly run by a computer to solve a problem. A binary-format instruction is made up of all 0’s and 1’s, because computers understand only 0’s and 1’s. Here's an example of an object- code instruction: 0100001111101010  This particular object-code instruction is referred to as a 16-bit instruction because each of the 0’s and 1’s is a bit, and there are 16 of them.  Each object-code instruction is in charge of only a simple computer task. For example, an object-code instruction could possibly be in charge of copying a single number from some place in main memory to some place in the CPU.  Programmers sometimes refer to object code as machine code. Object code is called machine code because it's written in binary and that's what a computer “machine” understands. 13
  • 14. Portability  A piece of software is portable if it can be used on many different types of computers.  Object code is not very portable. As you know, object code is comprised of binary-format instructions. Those binary-format instructions are intimately tied to a particular type of computer. If you've got object code that was created on a type X computer, then the object code can run only on a type X computer.  The Java solution to improve portability:  Java compilers don't compile all the way down to object code. Instead, they compile down to bytecode, which possesses the best features of both object code and source code:  Like object code, bytecode uses a format that works closely with computer hardware, so it runs fast.  Like source code, bytecode is generic, so it can be run on any type of computer. 14
  • 15. Java Virtual Machine  How can bytecode be run on any type of computer?  As a Java program’s bytecode runs, the bytecode is translated into object code by the computer's bytecode interpreter program. The bytecode interpreter program is known as the Java Virtual Machine, or JVM for short. The next slide shows how the JVM translates bytecode to object code. It also shows how a Java compiler translates source code to bytecode. 15
  • 16. The Compilation Process for Java Programs Java source code object code Java compilers compile source code into bytecode. bytecode When a Java program is run, the JVM translates bytecode to object code. 16
  • 17. History of Java  In the early 1990's, putting intelligence into home appliances was thought to be the next "hot" technology.  Examples of intelligent home appliances:  Coffee pots and lights that can be controlled by a computer's programs.  Televisions that can be controlled by an interactive television device's programs.  Anticipating a strong market for such things, Sun Microsystems in 1991 funded a research project (code named Green) whose goal was to develop software for intelligent home appliances.  An intelligent home appliance's intelligence comes from its embedded processor chips and the software that runs on the processor chips.  Appliance processor chips change often because engineers continually find ways to make processor chips smaller, less expensive, and more powerful.  To handle the frequent turnover of new chips, appliance software must be extremely portable. 17
  • 18. History of Java  Originally, Sun planned to use C++ for its home appliance software, but they soon realized that C++ was less than ideal because it wasn't portable enough and it relied too heavily on hard-to-maintain things called pointers.  Thus, rather than write C++ software and fight C++'s inherent deficiencies, Sun decided to develop a whole new programming language to handle its home appliance software needs.  Their new language was originally named Oak (for the tree that was outside project leader James Gosling's window), but it was soon changed to Java.  When the home appliance software work dried up, Java almost died before being released.  Fortunately for Java, the World Wide Web exploded in popularity and Sun realized it could capitalize on that. 18
  • 19. History of Java  Web pages have to be very portable because they can be downloaded onto any type of computer.  What's the standard language used for Web pages?  Java programs are very portable and they're better than HTML in terms of providing user interaction capabilities.  Java programs that are embedded in web pages are called applets.  Although applets still play a significant role in Java's current success, some of the other types of Java programs have surpassed applets in terms of popularity.  In this course, we cover Standard Edition (SE) Java applications. They are Java programs that run on a standard computer – a desktop or a laptop, without the need of the Internet. 19