Unit 1 - OOP in Java Intro
Unit 1 - OOP in Java Intro
JAVA
INSTRUCTOR: MR T.T GOTORA
EMAIL: [email protected]
COURSE CONTENT
OOP Principles
History of Java
Java Buzzwords
Differences between Java, C++ and C#.
The Java Virtual Machine
Setting Up Environment
COURSE CONTENT
Program Execution
Program Syntax
Data Types
Control Structures
Class Basics
Example Program
OOP PRINCIPLES
Inheritance
Encapsulation
Polymorphism
HISTORY OF JAVA
Descendant of C.
Adopts it syntax from C and OOP features from C++.
Started as Oak in 1991 by J. Gosling and colleagues at Sun
Microsystems.
Renamed Java in 1995.
Created initially for consumer electronics.
Internet encouraged its populace due its platform independence nature.
JAVA BUZZWORDS
Simple
Secure
Portable
Object-oriented
Robust
Multithreaded
JAVA BUZZWORDS
Architecture-neutral
Interpreted
High performance
Distributed
Dynamic
Java Virtual Machine (JVM)
Enables Bytecode to be run on it.
Go to My Computer (Right Click), Select Properties then Advanced System Settings,
Click on Environmental Variables
Create Path (add jdk path) and Classpath (add rt.jar and tools.jar) System Variables.
Set path in Linux if bash is the shell, add the following line to the end of
.bashrc_profile file using vi editor ‘.bashrc: export PATH=/path/to/java:$PATH’
PROGRAM EXECUTION
/*
This is a simple Hello world program.
Call this file “Hello.java".
*/
class Hello {
// Your program begins with a call to main().
public static void main(String args[]) {
System.out.println(“Hello World.");
}
PROGRAM EXECUTION
To compile the program enter javac Hello.java in command line.