1. Introduction to Java
History of Java: Java was developed by James Gosling and his team at Sun Microsystems in the
mid-1990s. It is designed to be platform-independent with the philosophy of 'write once, run
anywhere'.
Characteristics of Java: Java is an object-oriented, class-based, and concurrent language. It is
known for its portability, robust security, and automatic memory management through garbage
collection.
Structure of a Java Program: A typical Java program consists of classes, methods, and packages,
with the main() method serving as the entry point.
2. Data Types and Variables in Java
Basic Data Types: Common data types include int (integer), float (floating-point), char (character),
double (double precision floating-point), and boolean (boolean).
Constants and Literals: Constants are fixed values that do not change during program execution,
while literals are the direct representation of values like numbers or characters.
Variable Declaration: Variables must be declared before they are used, specifying the type and
name of the variable.
3. Operators in Java
Arithmetic Operators: Includes +, -, *, /, % for performing basic arithmetic.
Relational Operators: Used to compare values, such as ==, !=, >, <.
Logical Operators: Logical operations include && (AND), || (OR), ! (NOT).
Bitwise Operators: Operators like &, |, ^, <<, and >> are used to manipulate data at the bit level.
Assignment and Miscellaneous Operators: Assignment uses = to assign values, and other operators
include sizeof, ? : (ternary), etc.
4. Control Structures in Java
if, if-else, and nested if statements: Used for conditional execution of code blocks.