0% found this document useful (0 votes)
61 views

1 - The Java Programming Language

The Java Programming Language by Maam AFP

Uploaded by

Letecia Malangot
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

1 - The Java Programming Language

The Java Programming Language by Maam AFP

Uploaded by

Letecia Malangot
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

THE JAVA PROGRAMMING LANGUAGE An Executable File is a file that can be directly executed or

run by a processing unit (again, most often the CPU) or run by


Java was created in 1991 by James Gosling (Sun
another program that executes the file.
Microsystems)
- When a program executes (runs) the instructions of that
Why?
program are carried-out.
- They needed a programming language that could be used to
Executable files containing machine code can run without aid
write a wide variety of applications and be processed on very
by a processing unit.
different devices.
Executable files created by the Java compiler are in Java Byte
Traditional programming languages cannot do this.
Code, which are not specific to any platform, and thus cannot
Why? be run directly by a processing unit.
- Most general-purpose programming languages at that time Java executable files must be run by a special program
were platform specific. installed on a machine called the Java Virtual Machine (JVM).
A General-Purpose Programming Language is a programming The Java Virtual Machine (JVM) is a program that reads
language designed to be used for writing software in a wide instructions from Java Byte Code and executes them for the
variety of application domains. platform that the JVM is installed on.
A programming language is platform-specific, if once The JVM is often called an interpreter, because it “interprets”
compiled, it can only be guaranteed to be able to run on the java byte code to be run on whatever machine it is installed
machine it was compiled for. on. For this reason, Java is often called an interpreted
Java is NOT platform-specific. language, as opposed to a “true” compiled language

FROM SOURCE CODE TO A RUNNING PROGRAM So, why was Java created again?

- Code of any programming language must be saved into a - So the programs written in it can be run on different devices
file. easily.

- This file contains the source code for the program, and thus - This means that Java programs are very easily portable.
is called a source file. - Portability in programming means that a program can be
Source Code – is the human written code for a program. written on one computer and run on many different ones.

- Java is known as a high-level language. In traditional compiled languages, you must recompile your
program from the source code for every different machine
- A High-Level Programming Language is a language that is you want to run it on.
easily read and written by humans, and is needed to be
translated before a machine can use it. It provided a high - Tedious
level of abstraction from the details of the workings of the - Can run into problems between systems
computer’s hardware
As long as the machine you want to execute the program has
- Most programming by humans is done in high-level a compatible version of the JVM, your Java program can be
languages run on it without recompiling it!
- The source file for a high-level language needs to be If the JVM is correctly installed, there is (almost…) no
translated into a form that a machine can understand problems.
through a process called compilation.
Steps to create and run Java Program:
Compilation - is the process of translating high-level language
1. Write the source code in the Java programming
into machine language for platform-specific languages or
language.
some other intermediate code representation for other
2. Run the source code through the Java Compiler
languages. A program called a compiler does this.
(Interpreter)
Machine Language is a sequence of instructions directly 3. Run the resulting Java Byte Code through the JVM
executed by a processing unit (CPU in most cases). 4. The program executes!
- When you compile Java source code it results in Java Byte
Code, NOT Machine (Specific) Language
Running a compiler successfully on source code results in an
executable file.

You might also like