Beruflich Dokumente
Kultur Dokumente
Principles of Programming
in
Java
First Year
Computer Science Insttiute
Rebwar Kh Muhmmed
2019-2020
1
History of Programming Languages
2
Top Viral Programming Languages & Their
Creators...!
3
History
4
History (Cont.)
Sun Microsystems in1991 funded an internal corporate
research project (Green Project) led by James Gosling.
Java was officially announced in May 1995.
5
Why Computer Programming?
“Everybody in this country should learn how to program a
computer… because it teaches you how to think.”
((Steve Jobs))
6
Why Java?
Java is a general purpose programming language.
Java is the Internet programming language.
Java is a versatile programming language, you can use
it to develop applications for:
Desktop computers,
Servers, and
Small handheld devices.
Example:The software for Android cell phones is developed using Java.
7
8
Programming Language Level
9
The Java Programming Language
As a programming language, Java can create all kinds of
applications that you could create using any conventional
programming language.
10
In the Java programming language
All Java source files must end with the .java extension
Those source files are then compiled into .class files by the javac compiler.
it instead contains bytecodes — the machine language of the Java Virtual Machine
(Java VM).
The java launcher tool then runs your application with an instance of the Java
Virtual Machine.
12
The Advantage
the Java VM is available on many different operating systems, the same .class
files are capable of running on Microsoft Windows, Linux, or Mac OS.
15
The Java APIs
An Application Program Interface (API) is a set of
commands, functions, and protocols which
programmers can use when building software.
16
Java IDE Tools
Borland JBuilder
NetBeans Open Source by Sun
Other tools:
TextPad Editor
JCreator LE
JGrasp
BlueJ
DrJava
17
Java Program Development
Phase 1.0 : Editor
Phase 2.0 : Compiler
Phase 3.1 : Class Loader
Phase 3.2 : Bytecode Verifier
Phase 3.3 : Java Virtual Machine
18
Java Program Development: Edit
}
}
21
Simple First Program: "Hello World
public // Accessible outside this file. "public" is a reserved word.
class // "class" is a reserved word.
(String[] argv) // Command line parameters are placed by the run-time system
// in argv[0], argv[1], etc.
2. System.out.println();
Prints a blank line on the console.
23
Syntax and syntax errors
syntax: The set of legal structures and commands that can be used in
a particular programming language.
}
}
The code in this program instructs the computer to print four messages on the
screen.
26
Comments
.
Comments in Java can be one of three styles:
–Single line
•starts at //anywhere on a line
•ends at the end of that line
–Multi-line
•starts with character sequence /*anywhere
•ends with character sequence */anywhere after that
•can span multiple lines
27
Escape sequences
.
Escape sequences, or escape characters, begin with a slash and are
immediately followed by another character.
This two-character sequence, inside ""allows you to control your output (\n,
\t, \b) or output characters you wouldn't otherwise be able to (\\, \") inside a
string.
28
Output multiple lines with one output statement
29
30