Java Tutorial #02 | Variables and Data Types in Java Explained | Java for Beginners

Published: 27 October 2026
on channel: Code with Sam
28
2

🚀 *Welcome back to Code with Sam!* 💻

In *Java Tutorial #02**, we will learn about **Variables and Data Types in Java* with simple explanations and practical coding examples.

Variables and data types are among the most important fundamentals of Java programming. If you're a beginner, this tutorial will help you understand how to store and work with different types of data in Java.

📚 *What You'll Learn in This Video:*

✅ What is a variable in Java?

✅ How to declare and initialize variables

✅ Rules for naming variables

✅ What are data types in Java?

✅ Primitive data types in Java:
`int` – Integer numbers
`double` – Decimal numbers
`float` – Floating-point numbers
`char` – Single characters
`boolean` – True or false
`byte`, `short`, `long` – Other integer types

✅ Introduction to non-primitive data types such as `String`

✅ Practical Java examples

💻 *Example Code:*

```java
public class Main {
public static void main(String[] args) {

int age = 21;
double cgpa = 3.77;
char grade = 'A';
boolean isStudent = true;
String name = "Sam";

System.out.println("Name: " + name);
System.out.println("Age: " + age);
System.out.println("CGPA: " + cgpa);
System.out.println("Grade: " + grade);
System.out.println("Student: " + isStudent);
}
}
```

🎯 *Who Should Watch This Tutorial?*

Complete Java beginners
Computer Science and Software Engineering students
Anyone learning programming from scratch
Students preparing for Java exams and assignments

📌 *Java Programming Course — Beginner to Advanced*

This is Lecture #02 of our complete Java programming course.

📺 *Previous Video:* Java Tutorial #01 – Your First Java Program (Hello World)

🔜 *Next Video:* Java Tutorial #03 – User Input Using Scanner in Java

🔔 Subscribe to *Code with Sam* for daily programming tutorials covering Java, Python, C++, OOP, and practical projects.

👍 Like the video if you found it helpful!

💬 Comment below if you have any questions.

❤️ *Keep Learning, Keep Coding!*

#JavaProgramming #JavaVariables #JavaDataTypes #JavaTutorial #LearnJava #JavaForBeginners #CodeWithSam


On this page of the site you can watch the video online Java Tutorial #02 | Variables and Data Types in Java Explained | Java for Beginners with a duration of hours minute second in good quality, which was uploaded by the user Code with Sam 27 October 2026, share the link with friends and acquaintances, this video has already been watched 28 times on youtube and it was liked by 2 viewers. Enjoy your viewing!