Chapter 01 Introduction To Java
Chapter 01 Introduction To Java
Introduction
to Java
Contents
1. Introduction
1
1. Why Program?
2
1. Computer Systems: Hardware and Software
3
1. Programming Languages
4
1. What Is a Program Made Of?
5
1. The Programming Process
6
1. Object-Oriented Programming
7
1.1 Introduction
This book teaches programming using Java.
Java is a powerful language that runs on practically every type of
computer used to create large applications, small programs, mobile
applications, and code that powers a website.
Before plunging right into learning Java, however, this chapter will
review the fundamentals of computer hardware and software, then
take a broad look at computer programming in general.
1.2 Why Program?
Computer – programmable machine designed to
follow instructions
Program/Software – instructions that a computer
follows to perform a task
Programmer – person with the right skills who
designs, creates, and tests programs for computers
SO, without programmers, no programs; without
programs, the computer cannot do anything
Programming – an Art and Science
Computer programming is both an art and a science. It is an art because every
aspect of a program should be carefully designed. Here are a few of the things that
must be designed for any real-world computer program:
The logical flow of the The mathematical The layout of the
instructions procedures programming statements
It is also programming is a science. Because programs rarely work right the first time they
are written, a lot of analyzing, experimenting, correcting, and redesigning is required.
1.3 Computer Systems: Hardware and Software
Hardware refers to the physical components of which a computer is made.
A computer, as we generally think of it, is not an individual device, but a
system of devices.
The major hardware components of a computer are:
A. The central processing unit (CPU)
B. Main memory
C. Secondary storage devices
D. Input and Output devices
The Central Processing Unit (CPU)
At the heart of the computer is the central processing unit(CPU)
The CPU’s job is to fetch instructions, follow instructions, and produce
some resulting data Internally, the CPU consists of two parts:
Control Unit: Coordinates all of the computer’s operations
Arithmetic and Logic Unit (ALU): Performs mathematical operations
CPU
Arithmetic
Logic
Unit
Control
Unit
Main memory
Commonly known as random-access memory (RAM)
RAM contains:
• currently running programs
• data used by those programs.
RAM is volatile, which means that when the computer is turned off, the contents of
RAM are erased.
RAM is divided into units called bytes.
A byte consists of eight bits that may be either on or off.
Each byte in memory is assigned a unique number known as an address.
Secondary Storage
Solid
Hard Disk
State USB Optical
Drivers(H CD/DVD
Drive(SSD Drive Device
DD)
)
Input Devices
Input is any data the computer collects from the outside world.
That data comes from devices known as input devices.
Common input devices:
Common input devices
System Application
Utility Program
Software Software
Pasca Pyth
C VB.net C++ Java
l on
Continue,…
A class is a collection of programming statements that specify the attributes
and methods that a particular type of object may have.
Think of a class as a “blueprint” that objects may be created from.
So, a class is not an object, but a description of an object
Methods
Or Behaviors
Inheritance
Inheritance is the ability of one class to extend the capabilities of another.
Server
For example, consider a program that uses classes representing cars, trucks,
and jet planes. Applications
Although those three types of objects in the real world are very
different, they have some common characteristics.
They are all modes of transportation, and they all can carry some number
of passengers. So, each of the three classes could be based on a Vehicle
class
In OOP terminology, the Vehicle
class is the superclass.
The Car, Truck, and JetPlane
classes are subclasses.
ANY
QUESTIONS
و ا ل س ال م ع ل ي ك م
ورحمة الله
ه ت ا
Eng.Mahad Ahmed
ك ر ب و
Jimale
+252-618-95-95-95
[email protected]