Welcome back to our comprehensive Java tutorial series! In our first session, we explored the basics of Java, its installation, and why it's a powerful programming language. Today, we dive deeper into the Java world, learning about variables, data types, and operators – essential building blocks for any software developer.

We'll approach this tutorial with a mix of theory and practical examples, ensuring you grasp concepts firmly. So, let's buckle up and embark on this exciting journey!

Variables and Data Types
Variables are containers for data values, which are essential for storing and manipulating data in your programs. They enable you to use meaningful names for your data instead of working with raw values.

Java supports eight primitive data types, used for storing values of different types, such as integers, floating-point numbers, characters, and Boolean values.
Primitive Data Types

Java's primitive data types include byte, short, int, long, float, double, char, and boolean. Each has a fixed size and cannot be null.
Here are their sizes, valid ranges, and an example:
| Data Type | Size (bits) | Valid Range | Example |
|---|---|---|---|
| byte | 8 | -128 to 127 | byte b = 100; |
| short | 16 | -32,768 to 32,767 | short s = 10000; |
| int | 32 | -2,147,483,648 to 2,147,483,647 | int i = 1000000; |
| long | 64 | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | long l = 1000000000000L; |
| float | 32 | 1.4E-45 to 3.4E+38 | float f = 10.99f; |
| double | 64 | 4.9E-324 to 1.8E+308 | double d = 10.99; |
| char | 16 | '\u0000' to '\uffff' | char c = 'a'; |
| boolean | Unknown | true | false | boolean b1 = true; |

Non-Primitive Data Types (Reference Types)
Besides primitive types, Java supports reference types, such as classes, interfaces, and arrays. These variables store memory address references rather than actual values.
Let's create an array of integers as our first example of a reference type:

Type name;
Here, Type could be any reference type (like int[], String, or CustomClass), and name is the variable name.



















int[] numbers;
Initializing the array:
int[] numbers = new int[5];
Operators in Java
Operators perform operations on variables and values. Java supports a rich set of operators, facilitating efficient and expressive code.
Let's classify and explore Java operators in detail.
Arithmetic Operators
Arithmetic operators perform mathematical operations, like addition (+), subtraction (-), multiplication (*), division (/), modulus (%), increment (++), and decrement (--).
Example:
int a = 10;
int b = 5;
int c = a + b;
System.out.println(c);
Output: 15
Comparison Operators
Comparison operators compare two values and return a Boolean value (true or false): equality (==), not equal (!=), greater than (>), less than (<), greater than or equal to (>=), and less than or equal to (=<).
Example:
int a = 10;
int b = 5;
boolean isEqual = a == b;
System.out.println(isEqual);
Output: false
Logical Operators
Logical operators combine and manipulate Boolean values: AND (&&), OR (||), and NOT (!).
Example:
boolean a = true;
boolean b = false;
boolean c = a || b;
System.out.println(c);
Output: true
Expriment with these operators in your coding environment to gain a better understanding of their usage. In our next session, we'll delve into control structures, loops, and decision-making in Java.
Your journey into the world of Java is just beginning, and we're excited to have you along for the ride. Keep practicing, experimenting, and building – that's the best way to master any programming language. Until next time, happy coding!