Fundamentals of Programming
By Budditha Hettige
Department of Statistics and Computer Science
1
Overview
• • • • • • • • • Exercises (Previous Lesson) The JAVA Programming Languages Java Virtual Machine Characteristics What is a class? JAVA Standards JAVA Keywords How Install JAVA Sample Java Program
2
Exercises
Draw a flowchart for the following
1. 2. 3. Enter two number from key bard and print average Enter three number and find the maximum number Process of the ATM machine
3
JAVA
• Is a programming language created by James Gosling from Sun Microsystems in 1991 • Is a general-purpose, class-based, objectoriented Programming language • is intended to let application developers “write once, run anywhere.” • Current version (JDK) 7u21 • URL : http://www.oracle.com/
4
Java cont…
• Java programming language consists
– Java compiler: Java compiler translates Java coding into byte-code – Java virtual machine(JVM) Java virtual machine interprets this byte-code and runs the program – Java class libraries Java Class Library is a set of dynamically loadable libraries that Java applications can call at run time
5
Java Virtual Machine (JVM) Architecture
JAVA Source File (.java) Java Virtual Machine Byte code Verifier Memory Manager JAVA Bite code (.class)
Java Compiler
Interpreter
Java API
6
JAVA Vs C++
JAVA Source File (.java)
C++ Source File (.cpp)
Java Compiler
C++ Compiler
JAVA Bite code (.class)
Executable program (.exe) Operating system can directly execute
Java VM
JAVA VM can directly execute
7
Characteristics
Java has the following properties • Platform independent • Object-orientated programming language • Strongly-typed programming language • Interpreted and compiled language • Automatic memory management
8
Platform independent
• Can Run on any Platform
– Windows – Linux – MaC OS
JAVA Source File (.java)
Java Compiler
JAVA Bite code (.class)
Java VM
9
Object-orientated programming language
• Object-oriented programming