Introduction to OOP in Java
Introduction to OOP in Java
PROGRAMMING
INTRODUCTION TO JAVA
INTRODUCTION JAVA
• Java is simple
• Java is object-oriented
• Java is distributed
• Java is interpreted
• Java is robust
• Java is secure
• Java is architecture-neutral
• Java is portable
• High performance
• Java is dynamic
JAVA FEATURES
Simple
• Fixes some clumsy features of C++
• No pointers
• Automatic garbage collection
Object Oriented Programming
• Focus on the data (objects) and methods manipulating the data
• All functions are associated with objects
• Almost all datatypes are objects (files, strings, etc.)
• Potentially better code organization and reuse
JAVA FEATURES
Reliable (Robust)
• Extensive compile-time and runtime error checking.
• No pointers but real arrays. Memory corruptions or unauthorized memory accesses
are impossible.
• Automatic garbage collection tracks objects usage over time.
Secure
• Usage in networked environments requires more security.
• Memory allocation model is a major defense.
• Access restrictions are forced (private, public).
DIFFERENCE BETWEEN C++ & JAVA
• Structure of Java
• Program Data Types
• Variables
• Operators
• Keywords
GENERAL STRUCTURE OF JAVA PROGRAM
JAVA TOKENS
• Primitive(built-in)
• Non Primitive(Derived)
Arrays
Classes
Interface
DATA TYPES
OPERATOR TYPES
• Types of operators:
Assignment Operators
Arithmetic Operators
Unary Operators
Equality Operators
Relational Operators
Conditional Operators
Instance of Operator
Bitwise Operators
Shift Operators