What is aprogram?
• The simplest definition is to view algorithm as a set of steps that
define how a task is performed.
• Computer programs, known as software, are instructions that tell a
computer what to do. It is a representation of an algorithm is called a
program.
• The process of developing a program is known as “Programming”
3.
What is aprograming language?
• Computers do not understand human languages, so programs must
be written in a language a computer can use.
• A programming language is a special language used to write
computer programs.
• Categories of programming language:
• Machine Language
• Assembly Language
• High-Level Language
4.
MACHINE LANGUAGE
• aset of built-in primitive instructions. These instructions are in the
form of binary code.
• The native language of the computer (understand directly) but are
very difficult to read and modify.
5.
ASSEMBLY LANGUAGE
• Ituses a short descriptive word to represent each of the
machine-language instructions.
• Ex: add 2, 3, result
• An instruction in assembly language essentially corresponds to an
instruction in machine code. Writing in assembly requires that you
know how the CPU works.
• Because the computer cannot execute assembly language, another
program—called an Assembler—is used to translate assembly-
language programs into machine code.
6.
HIGH-LEVEL LANGUAGE
• Theyare platform independent, which means that you can write a
program in a high-level language and run it in different types of machines.
High-level languages are English-like and easy to learn and use like : Java
• A program written in a high-level language is called a source program or
source code.
• a source program must be translated into machine code for execution.
The translation can be done using another programming tool called an
Interpreter or a Compiler.
• An interpreter reads one statement from the source code, translates it to the
machine code or virtual machine code, and then executes it right away.
• A compiler translates the entire source code into a machine-code file, and
the machine-code file is then executed
Lifecycle of javaprogram
• You save a Java program in a .java file and
compile it into a .class file. The .class file is
executed by the Java Virtual Machine( .
Java source code is compiled into Java
bytecode and Java bytecode is interpreted
by the JVM.)
• JVM(Java Virtual Machine): is a program
that interprets Java bytecode.
• one of Java’s primary advantages: Java
bytecode can run on a variety of
hardware platforms and operating
systems.