Chapter One: Introduction To Computers, Programs, and Java
Chapter One: Introduction To Computers, Programs, and Java
Chapter One: Introduction To Computers, Programs, and Java
1
Objectives
To review computer basics and programs
7
What is Programming Languages?
Assembly Language
8
What is Programming Languages?
High-Level Language
They are platform-independent, which means that
you can write a program in a high level language and
run it in different types of machines.
The high-level languages are English-like and easy to
learn and program.
The instructions in a high-level programming
language are called statements.
For example, the following is a high-level language
statement that computes the area of a circle with
radius 5: area = 5 * 5 * 3.1415;
9
What is Programming Languages?
High-Level Language
There are many high-level programming languages,
and each was designed for a specific purpose.
11
What is Programming Languages?
High-Level Language
15
Some Major Types of Programming Paradigms
16
Some Major Types of Programming Paradigms
1. Imperative or procedural
2. Declarative Logic Programming is a
programming paradigm based on
3. Logical or Rule based
formal logic.
4. Functional
5. Object-Oriented It is a set of sentences in logical
form, expressing facts and rules
about some problem domain.
17
Some Major Types of Programming Paradigms
1. Imperative or procedural
2. Declarative In this paradigm we express
3. Logical or Rule based computations as the evaluation of
4. Functional mathematical functions.
5. Object-Oriented
The reason is that the paradigm
originates from a purely mathematical
discipline: the theory of functions.
18
Some Major Types of Programming Paradigms
The object-oriented paradigm has
got great popularity in the recent
1. Imperative or procedural years.
2. Declarative
3. Logical or Rule based Object-Oriented Programming is a
4. Functional programming paradigm based on the
concept of “Objects”, which may
5. Object-Oriented contain data, in the form of fields,
often known as Attributes; and code,
in the form of Methods.
21
Some Uses of Java Programming Language
An application is a program
Java can be used to develop: that runs on your computer,
a) Applications under the operating system of
that computer. An application
created by Java is more or less
like one created using any other
Java is a general purpose type of computer language,
programming language. such as Visual Basic or C++.
You can use it to develop Java applications do
applications on your desktop and on
have the main() as
the server.
You can also use it to develop member of their class
applications for small hand-held
devices, such as personal digital
assistants (PDA) and cell phones.
E.g., The following pictures shows a Java
program that displays the calendar on a
BlackBerry® and on a cell phone. 22
Java can be used to develop applications for hand-held and wireless
devices, such as a BlackBerry, PDA and Cell Phone.
23
Some Uses of Java …
An applet is an application
b) Java applets designed to be transmitted over
the Internet and executed by a
Java-compatible Web browser.
25
Some Uses of Java …
c) Server-side applications
Java server pages (JSP)
Java Servlets
Java Server Face (JSF)
Java Beans, etc.
d) Multimedia application
Java Graphics, Java Graphics 2D, etc.
e) Etc…
26
Key Features of Java Technology
No language is simple, but Java is
a bit easier than the popular
Java Is Simple object-oriented programming
Java Is Object-Oriented language C++, which was the
Java Is Distributed dominant software-development
Java Is Interpreted language before Java.
Java Is Robust Java is partially modeled on C++,
Java Is Secure but greatly simplified and
Java Is Architecture-Neutral improved.
Java Is Portable
Java is Performance
Java Is Multithreaded
Java Is Dynamic
27
Key Features of Java …
Java is inherently object-oriented.
Java Is Simple Although many object-oriented
Java Is Object-Oriented languages began strictly as procedural
Java Is Distributed languages, Java was designed from the
start to be object-oriented.
Java Is Interpreted
Java Is Robust Object-oriented programming (OOP) is
Java Is Secure a popular programming approach that
is replacing traditional procedural
Java Is Architecture-Neutral programming techniques.
Java Is Portable
One of the central issues in software
Java is Performance
development is how to reuse code.
Java Is Multithreaded Object-oriented programming provides
Java Is Dynamic great flexibility, modularity, clarity, and
reusability through encapsulation,
inheritance, and polymorphism.
28
Key Features of Java …
Java Is Simple
Java Is Object-Oriented
Distributed computing involves several
Java Is Distributed
computers working together on a
Java Is Interpreted network. Java is designed to make
Java Is Robust distributed computing easy.
Java Is Secure
Java Is Architecture-Neutral Since networking capability is inherently
integrated into Java, writing network
Java Is Portable
programs is like sending and receiving
Java is Performance data to and from a file.
Java Is Multithreaded
Java Is Dynamic
29
Key Features of Java …
Java Is Simple
Java Is Object-Oriented You need an interpreter to run Java
Java Is Distributed programs. The programs are compiled
Java Is Interpreted into the Java Virtual Machine code
Java Is Robust called bytecode.
Java Is Secure The bytecode is machine-independent
Java Is Architecture-Neutral and can run on any machine that has a
Java Is Portable Java interpreter, which is part of the
Java is Performance Java Virtual Machine (JVM).
Java Is Multithreaded
Java Is Dynamic
30
Key Features of Java …
Java Is Simple
Robust means reliable.
Java Is Object-Oriented Java compilers can detect many
Java Is Distributed problems that would first show up at
Java Is Interpreted execution time in other languages.
Java Is Robust
Java has eliminated certain types of
Java Is Secure
error-prone programming constructs
Java Is Architecture-Neutral found in other languages.
Java Is Portable
Java is Performance Java has a runtime exception-handling
Java Is Multithreaded feature to provide programming
support for robustness.
Java Is Dynamic
31
Key Features of Java …
Java Is Simple
Java Is Object-Oriented Java implements several security
Java Is Distributed mechanisms to protect your system
against harm caused by stray programs.
Java Is Interpreted
Java Is Robust
Java Is Secure
Java Is Architecture-Neutral
Java Is Portable
Java is Performance
Java Is Multithreaded
Java Is Dynamic
32
Key Features of Java …
Java Is Simple
Java Is Object-Oriented
Java Is Distributed Architectural-Neutral means
Java Is Interpreted platform-independent.
Java Is Robust
With a Java Virtual Machine
Java Is Secure (JVM), you can write one program
Java Is Architecture-Neutral that will run on any platform.
Java Is Portable
Java is Performance Write once, run anywhere.
Java Is Multithreaded
Java Is Dynamic
33
Key Features of Java …
Java Is Simple
Java Is Object-Oriented
Java Is Distributed
Because Java is architecture
Java Is Interpreted
neutral, Java programs are
Java Is Robust portable.
Java Is Secure
Java Is Architecture-Neutral They can be run on any platform
Java Is Portable without being recompiled.
Java is Performance
There is no platform-specific
Java Is Multithreaded features in the Java language.
Java Is Dynamic
34
Key Features of Java …
35
Key Features of Java …
Java Is Simple
Java Is Object-Oriented
Java Is Distributed
Java Is Interpreted
Java Is Robust
Java Is Secure Multithreading is a program’s capability
Java Is Architecture-Neutral to perform several tasks simultaneously.
Java Is Portable
Java is Performance Multithread programming is smoothly
Java Is Multithreaded integrated in Java, whereas in other
languages you have to call procedures
Java Is Dynamic specific to the operating system to enable
multithreading.
36
Key Features of Java …
Java Is Simple
Java Is Object-Oriented
Java Is Distributed
Java Is Interpreted
Java Is Robust Java was designed to adapt to an
evolving environment.
Java Is Secure
Java Is Architecture-Neutral New code can be loaded on the fly
Java Is Portable without recompilation.
Java is Performance There is no need for developers to
Java Is Multithreaded create, and for users to install, major
new software versions.
Java Is Dynamic New features can be incorporated
transparently as needed.
37
The Java Language Specification, API, JDK, and IDE
39
The Java Language Specification…
NB:
If you have the JDK installed, you don’t need to install
the JRE separately to run any Java software.
JVM is platform dependent
41
The Java Language Specification…
Integrated Development Environment (IDE) is provided by the
Java development tool for rapidly developing Java programs.
42
Java Development Tools
46
Creating, Compiling, and Executing ...
Result
47
If runtime errors or incorrect result
Java Environment/Life Cycle of Java Code
Runtime
Compile-time Environment Class
Environment Java
Loader
Class
Bytecode Libraries
Java Verifier
Source
(.java)
Just in
Java
Time
Interpreter Java
Java Compiler
Bytecodes Virtual
Java move locally machine
Compiler or through
network
Runtime System
Java
Bytecode Operating System
(.class )
Hardware
Question Answer
49