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

1. Fundamentals of programming (Java)

Java programming language

Uploaded by

Hayat Hyt
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

1. Fundamentals of programming (Java)

Java programming language

Uploaded by

Hayat Hyt
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Khana-e Noor University

Computer Science Faculty

Fundamentals Of
Programming (Java)
Reference
Outline
 What is a Program
 A Brief History of Java
 Advantages of Java
 High Level vs Low Level programming
Languages
 Compiler vs Interpreter
 Understanding Compiler Errors
 Programming Your First Java Application
What is a Program
 In computing, a program is a specific set of ordered
operations for a computer to perform.
 The program contains a one-at-a-time sequence of
instructions that the computer follows.
 Typically, the program is put into a storage area
accessible to the computer.
 The computer gets one instruction and performs it
and then gets the next instruction.
A Brief History of Java
 The history of Java is very interesting. Java was
originally designed for interactive television, but it
was too advanced technology for the digital cable
television industry at the time. The history of java
starts with Green Team.
 Java team members (also known as Green Team),
initiated this project to develop a language for digital
devices such as set-top boxes, televisions, etc.
 However, it was suited for internet programming.
Later, Java technology was incorporated by Netscape.
A Brief History of Java
 The principles for creating Java programming
were "Simple, Robust, Portable, Platform-
independent, Secured, High Performance,
Multithreaded, Architecture Neutral, Object-
Oriented, Interpreted and Dynamic".
 Currently, Java is used in internet
programming, mobile devices, games, e-
business solutions, etc. There are given the
significant points that describe the history of
Java.
Advantages of Java
1. Java is easy to learn.
Java was designed to be easy to use and is therefore easy to
write, compile, debug, and learn than other programming
languages.
2. Java is object-oriented.
This allows you to create modular programs and reusable
code.
3. Java is platform-independent.
One of the most significant advantages of Java is its ability to
move easily from one computer system to another. The
ability to run the same program on many different systems is
crucial to World Wide Web software, and Java succeeds at
this by being platform-independent at both the source and
binary levels.
Advantages of Java (Cont.)
4. Java is distributed.
Java is designed to make distributed
computing easy with the networking capability that is inherently
integrated into it. Writing network programs in Java is like sending
and receiving data to and from a file.
5. Java is secure.
Java considers security as part of its design. The Java language,
compiler, interpreter, and runtime environment were each
developed with security in mind.
6. Java is robust.
Robust means reliability. Java puts a lot of emphasis on early
checking for possible errors, as Java compilers are able to detect
many problems that would first show up during execution time in
other languages.
Advantages of Java (Cont.)
7. Java is multithreaded.
Multithreaded is the capability for a program to perform several
tasks simultaneously within a program. In Java, multithreaded
programming has been smoothly integrated into it, while in other
languages, operating system-specific procedures have to be called
in order to enable multithreading.

 Because of these features Java has become a language of choice


for providing worldwide Internet solutions.
High Level Programming
Language
 A high-level language is a programming
language designed to simplify computer
programming.
 It is "high-level" since it is several steps removed from
the actual code run on a computer's processor.
 High-level source code contains easy-to-
read syntax that is later converted into a low-level
language, which can be recognized and run by a
specific CPU.
 C#, Java, Cobol, Javascript, PHP, …
Low Level Programming
Language
 A low-level language is a programming language that
provides little or no abstraction of programming
concepts and is very close to writing actual
machine instructions.
 Two good examples of low-level languages
are assembly and machine code.
 Low-level languages are useful because written in them
can be crafted to run very fast and with a very
minimal memory footprint.
 However, they are considered harder to utilize because
they require a deeper knowledge of machine language.
Compiler
 A compiler is a computer program that transforms
computer code written in one programming
language (the source language) into another
programming language (the target language).
 Compilers are a type of translator that support digital
devices, primarily computers.
 The name compiler is primarily used for programs that
translate source code from a high-level programming
language to a lower level language (e.g., assembly
language, object code, or machine code) to create
an executable program.
Interpreter
 In computer science, an interpreter is
a computer program that directly executes,
i.e. performs instructions written in
a programming or scripting language, without
requiring them previously to have
been compiled into a machine
language program.
Compiler VS. Interpreter

 A compiler is a translator which transforms


source language (high-level language) into
object language (machine language).
 In contrast with a compiler, an interpreter is a
program which imitates the execution of
programs written in a source language.
 Another difference between Compiler and
interpreter is that Compiler converts the whole
program in one go on the other hand
Interpreter converts the program by taking a
single line at a time.
Compiler VS. Interpreter (Cont.)
Compiler VS. Interpreter (Cont.)
Java Programming Requirements

 JDK (Java Development Kit)


 IDE (Integrated Development Environment) Which we use
Eclipse
Simple Java Program
Compilation Errors
 When compiling your program, the compiler may find one
or more mistakes in your program.
 Syntax Errors
If you make a typing mistake while entering or editing your
program, the compiler may print out a syntax error. This
happens when something you typed doesn't conform to the
rules of the Java language.
If we forgot the semicolon on the statement that prints "Hello
World!", we might see the following error message when
compiling:
Any Questions?

You might also like