Introduction
In Week 1, we learned what Java is, how it works, and how to write our first “Hello World” program.
Now it’s time to start real Java programming.
In this article, we’ll explore:
Java program structure & syntax
Variables in Java
Data types (Primitive & Non-Primitive)
Type casting
Java naming conventions
These are fundamental concepts you must master before moving into logic and problem-solving.
Java Program Structure (Quick Recap)
A basic Java program looks like this:
public class Example {
public static void main(String[] args) {
// Code goes here
}
}
Important Rules
Every Java program has at least one class
Execution starts from the
main()methodJava is case-sensitive
Every statement ends with
;
What Is a Variable?
A variable is a container used to store data in memory.
Example:
int age = 25;
Here:
int→ data typeage→ variable name25→ value
Java Variable Syntax
dataType variableName = value;
Example:
String name = "Mahabub";
double salary = 55000.75;
boolean isActive = true;
Java Data Types Overview
Java data types are divided into two main categories:
1️⃣ Primitive Data Types
2️⃣ Non-Primitive (Reference) Data Types
Primitive Data Types in Java
Primitive data types store simple values and are by Java.


