You are on page 1of 20

Object Oriented

Programming 2
Object Oriented
Programming 2
OOP
Introduction
MACHINE LANGUAGE
Machine language is a numeric code that describes the actions that a certain machine can do
directly. The codes are binary digits (“bits”) that are often translated from and to hexadecimal (base
16) for human reading and alteration. Some bits are used to indicate operations, such as addition,
and others are used to represent operands or the position of the next instruction in machine language
instructions. Machine language is difficult to understand and write because its codes differ from
computer to computer and do not match standard mathematical notation or human language.
 Assembly language is one level above machine language. It employs short mnemonic codes for
instructions and allows the programmer to identify data-holding memory sections. For an
instruction that adds two numbers, one might write "add pay, total" instead of "0110101100101000."
 Assembly is written in a way that allows it to be readily converted into machine language.
Assembly language does not give a more sophisticated way of arranging complicated information,
despite the fact that blocks of data can be referred to by name rather than by their machine
addresses. Assembly language, like machine language, necessitates a thorough understanding of a
computer's underlying architecture. When such details are necessary, such as when programming a
computer to interface with input/output devices, it comes in handy (printers, scanners, storage
devices, and so forth).
The CPU spends virtually all of its time fetching and executing instructions
from memory. However, in a genuine computer system, the CPU and main
memory are just two of many components. Other devices found in a full system
include:
 A hard disk is a storage device that holds programs and data files. (It's
worth noting that main memory only stores a tiny quantity of data and
just for as long as the power is switched on.) A hard disk is required for
the long-term storage of huge volumes of data. Programs must still be
loaded into main memory from disk before they may be run.)
 A keyboard and mouse for user input.
 a monitor and printer for seeing the computer's output
 A modem is a device that connects a computer to other computers
through telephone lines.
 A network interface is a device that allows a computer to communicate
with other computers on the same network.
 A
 A scanner transforms pictures into binary numbers that may be saved and processed on a
computer.
 The list of devices is entirely open-ended, and computer systems are built to be
expanded by adding new devices easily. All these devices must interact with and be controlled
by the CPU in some way. Only machine language instructions may be executed by the CPU
(which is all it can do, period). It works because there is a device driver for each device in a
system, which is a piece of software that the CPU runs when it must interface with the device.
Installing a new device on a computer usually consists of two steps: physically connecting the
device to the computer and installing the device driver software. The physical device would
be worthless without the device driver since the CPU would not connect with it.
 A computer system with many devices is usually structured by connecting them to one
or more buses. A bus is a collection of cables that transmit data between the devices that are
connected to them. Data, addresses, and control signals are all carried through the cables. The
data is directed to a certain device and maybe to a specific register or place inside that device
via an address. One device can utilize control signals to inform another device that data is
accessible on the data bus.
THE JAVA VIRTUAL MACHINE

 A machine language is a set of very simple instructions that a computer's


CPU can directly execute. On the other hand, almost all programs are
written in high-level programming languages like Java, Pascal, and C++.
A high-level language program cannot be run directly on any machine. It
must first be converted to machine-readable form. A compiler converts a
high-level language program into a machine-language program that can
be executed. The machine-language program can be executed as many
times as necessary after the translation is complete. Still, it can only
operate on one type of computer (since each computer has its machine
language). If the program runs on another type of computer, it must be
re-translated, using a different compiler, into the appropriate machine
language.
FUNDAMENTAL BUILDING BLOCKS OF PROGRAMS

 Data and instructions are the two most fundamental components of programming.
Working with data necessitates an understanding of variables and types, whereas
working with instructions necessitates understanding control structures and
subroutines. You'll spend a lot of time in this class learning about these ideas.
A variable is nothing more than a memory location (or a collection of memory
locations) that has a name so that it may be recognized may be easily referenced
and used in a program. The name is the only thing the programmer needs to care
about; the compiler maintains track of the memory location. Even if the
programmer doesn't need to know where in memory the box is placed, the
programmer should bear in mind that the term refers to a type of "box" in memory
that may hold data.
VARIABLE
 A variable's type in Java and most other languages determines
what kind of data it may contain. Integers—whole numbers like 3,
-7, and 0—could be stored in one sort of variable— while another
holds floating-point numbers—numbers with decimal points such
as 3.14, -2.7, or 17.0. (Yes, the computer does distinguish between
the integer 17 and the floating-point number 17.0; Inside the
computer, they appear completely different.) Individual characters
might have their kinds (' A,";', etc.), dates, colors, sounds, and any
other sort of data that software would need to store are all
examples of strings ("Hello," "A string might comprise many
characters," etc.).
Relational Operators

You might also like