■ JAVA
Complete Beginner's Guide
Zero Knowledge → Job Ready
Simple • Clear • Tamil-friendly explanations
■ What you will learn
Chapter 1 What is Java? Setup & First Program
Chapter 2 Variables & Data Types
Chapter 3 Operators
Chapter 4 Conditions (if/else, switch)
Chapter 5 Loops (for, while, do-while)
Chapter 6 Arrays
Chapter 7 Methods (Functions)
Chapter 8 Object Oriented Programming (OOP)
Chapter 9 String Handling
Chapter 10 Exception Handling
Chapter 11 Collections (ArrayList, HashMap)
Chapter 12 Career Tips & Next Steps
Chapter 1: What is Java?
Java ■■■■■■■ ■■■■? (Simple Explanation)
Java is a programming language — basically a set of instructions we give to a computer. Like
how we talk in Tamil or English, computers understand Java.
Why Java for Career?
■ Used in 3 billion+ devices worldwide
■ Top language for Backend Development, Android Apps, Banking Software
■ High salary — avg ■5–15 LPA for freshers
■ Asked in TCS, Infosys, Wipro, Zoho, Cognizant interviews
■ Once you learn Java, other languages become easy
How Java Works (Simple Flow)
You write code (.java file) → Java compiler converts it → .class file created → JVM runs it on any
computer. This is why Java is called 'Write Once, Run Anywhere'.
Setup — Install Java (Step by Step)
Step 1 Go to [Link] → search 'JDK 17 download Oracle'
Step 2 Download JDK 17 (Windows/Mac/Linux — choose yours)
Step 3 Install it (just click Next → Next → Finish)
Step 4 Download VS Code from [Link]
Step 5 In VS Code, install 'Extension Pack for Java' plugin
Step 6 Create a file called [Link] and write your first program!
Your First Java Program
// This is your very first Java program!
public class Hello {
public static void main(String[] args) {
[Link]("Hello World!");
■ Explanation: public class Hello = create a class named Hello | main method = starting point of
program | [Link] = print something on screen
Chapter 2: Variables & Data Types
Variable ■■■■■■■ ■■■■?
Variable = a box to store data. Just like a box labelled 'sugar' stores sugar, in Java a variable
stores a value.
Data Type Stores Example Memory
int Whole numbers int age = 20; 4 bytes
double Decimal numbers double price = 99.5; 8 bytes
char Single character char grade = 'A'; 2 bytes
boolean True or False boolean pass = true; 1 bit
String Text/words String name = "Raj"; varies
long Very large numbers long pop = 1400000000L; 8 bytes
float Decimal (less precise)
float pi = 3.14f; 4 bytes
Example Program
public class Variables {
public static void main(String[] args) {
String name = "Karthik"; // Text
int age = 21; // Number
double marks = 89.5; // Decimal
boolean passed = true; // Yes/No
[Link]("Name: " + name);
[Link]("Age: " + age);
[Link]("Marks: " + marks);
■ Tip: Always end every statement with semicolon ( ; ) — most beginners forget this!
Chapter 3: Operators
Operators = symbols that do operations on values
Type Operator Meaning Example
Arithmetic + - * / % Math operations 10 % 3 = 1 (remainder)
Comparison == != > < >= <= Compare two values 5 > 3 → true
Logical && || ! AND, OR, NOT true && false → false
Assignment = += -= *= Assign values x += 5 means x = x+5
Increment ++ -- Add/subtract 1 x++ means x = x+1
Quick Example
int a = 10, b = 3;
[Link](a + b); // 13
[Link](a - b); // 7
[Link](a * b); // 30
[Link](a / b); // 3 (not 3.33 — int division!)
[Link](a % b); // 1 (remainder)
■■ int / int = int in Java. To get 3.33, use: double result = (double)a / b;
Chapter 4: Conditions (if / else / switch)
if / else
Condition = a decision. Like: if marks >= 50, you pass. else you fail.
int marks = 75;
if (marks >= 90) {
[Link]("Grade A");
} else if (marks >= 75) {
[Link]("Grade B");
} else if (marks >= 50) {
[Link]("Grade C");
} else {
[Link]("Fail");
switch Statement
Use switch when you compare ONE variable against multiple values:
int day = 2;
switch (day) {
case 1: [Link]("Monday"); break;
case 2: [Link]("Tuesday"); break;
case 3: [Link]("Wednesday"); break;
default: [Link]("Other day");
■ Tip: Don't forget 'break' after each case! Without break, all cases below will also run.
Chapter 5: Loops
Loop = repeat something multiple times. Instead of writing the same code 100 times, use a loop!
1. for Loop — when you know HOW MANY times to repeat
// Print 1 to 5
for (int i = 1; i <= 5; i++) {
[Link](i);
■ for (start ; condition ; step) → i=1, runs while i<=5, after each loop i++
2. while Loop — when you DON'T know how many times
int i = 1;
while (i <= 5) {
[Link](i);
i++;
3. do-while Loop — runs AT LEAST once
int i = 1;
do {
[Link](i);
i++;
} while (i <= 5);
Loop Type Use When
for You know the number of repetitions (e.g., print 1 to 100)
while You repeat based on a condition (e.g., until user enters 0)
do-while You want to run at least once (e.g., menu programs)
Chapter 6: Arrays
Array = store multiple values of the same type in ONE variable. Like a row of boxes — each box
has an index starting from 0.
// Store 5 students' marks
int[] marks = {85, 90, 78, 92, 88};
[Link](marks[0]); // 85 (first element)
[Link](marks[4]); // 88 (last element)
[Link]([Link]); // 5 (size of array)
Loop through an array
for (int i = 0; i < [Link]; i++) {
[Link]("Mark " + (i+1) + ": " + marks[i]);
// Shorter way using for-each loop
for (int m : marks) {
[Link](m);
■■ Index starts at 0 not 1! Array of 5 elements: index 0,1,2,3,4 Accessing index 5 will give
ArrayIndexOutOfBoundsException error!
Chapter 7: Methods (Functions)
Method = a block of code with a name. Instead of repeating the same code, put it in a method
and call it whenever needed.
Method Structure
returnType methodName (parameters) {
// code here
return value; // if returnType is not void
Example — Method with return value
public class Calculator {
// Method to add two numbers
static int add(int a, int b) {
return a + b;
// Method with no return (void)
static void greet(String name) {
[Link]("Hello " + name);
public static void main(String[] args) {
int result = add(10, 20); // Calling the method
[Link]("Sum: " + result); // 30
greet("Karthik"); // Hello Karthik
■ Use 'void' when method does NOT return anything. Use int/String/double etc. when it does.
Chapter 8: Object Oriented Programming (OOP)
OOP is the HEART of Java. Everything in Java is based on objects. It makes code organised,
reusable, and easy to maintain.
OOP Concept Simple Meaning Real Life Example
Class Blueprint / template Blueprint of a Car
Object Real thing created from class Your specific car (Honda City)
Encapsulation Hide internal data, show only needed
ATM machine — you press button, not see wiring
Inheritance Child class gets parent class features
Son inherits father's property
Polymorphism One method, many behaviours Same "speak()" — Dog barks, Cat meows
Abstraction Show only important details Car steering — you turn, engine handles rest
Class & Object Example
// Class = Blueprint
class Student {
String name; // attribute
int age;
// Constructor — called when object is created
Student(String n, int a) {
name = n;
age = a;
void display() {
[Link](name + " is " + age + " years old");
// Creating Objects
Student s1 = new Student("Karthik", 21);
Student s2 = new Student("Priya", 20);
[Link](); // Karthik is 21 years old
[Link](); // Priya is 20 years old
Inheritance Example
class Animal {
void eat() {
[Link]("Animal is eating");
// Dog INHERITS from Animal using 'extends'
class Dog extends Animal {
void bark() {
[Link]("Dog is barking");
Dog d = new Dog();
[Link](); // From Animal class — inherited!
[Link](); // Dog's own method
■ Dog gets eat() for free from Animal. This is Inheritance — reuse code!
Chapter 9: String Handling
Strings are used EVERYWHERE in real projects — names, emails, passwords, messages. Java
has many built-in String methods.
Method What it does Example
length() Count characters "Hello".length() → 5
toUpperCase() Convert to UPPERCASE "hello".toUpperCase() → HELLO
toLowerCase() Convert to lowercase "HELLO".toLowerCase() → hello
charAt(i) Get character at index i "Java".charAt(0) → J
substring(s,e) Extract part of string "Hello".substring(1,4) → ell
contains(str) Check if contains text "Hello".contains("ell") → true
replace(a,b) Replace text "Hello".replace("l","r") → Herro
trim() Remove spaces from ends " hi ".trim() → hi
equals(str) Compare two strings "abc".equals("abc") → true
split(regex) Split into array "a,b,c".split(",") → [a,b,c]
indexOf(str) Find position "Hello".indexOf("l") → 2
■■ Never compare Strings with == in Java! Always use .equals() s1 == s2 compares memory
address — WRONG! [Link](s2) compares actual text — CORRECT!
Chapter 10: Exception Handling
Exception = an error that occurs during program execution. Exception handling prevents your
program from crashing.
try-catch-finally
try {
// Code that might give error
int result = 10 / 0; // ArithmeticException!
} catch (ArithmeticException e) {
[Link]("Error: " + [Link]());
} finally {
[Link]("This always runs!");
Common Exception When it occurs
ArithmeticException Dividing by zero
NullPointerException Using a variable that is null
ArrayIndexOutOfBoundsException Accessing array index that doesn't exist
NumberFormatException Converting "abc" to integer
ClassCastException Wrong type casting
Chapter 11: Collections
Collections are like arrays but MORE POWERFUL — they can grow/shrink in size and have
many useful methods. Very important for interviews!
ArrayList — Dynamic Array
import [Link];
ArrayList names = new ArrayList<>();
[Link]("Karthik"); // add element
[Link]("Priya");
[Link]("Ravi");
[Link](names); // [Karthik, Priya, Ravi]
[Link]([Link]()); // 3
[Link]("Priya"); // remove element
[Link]([Link](0)); // Karthik
HashMap — Key-Value Pairs
import [Link];
HashMap scores = new HashMap<>();
[Link]("Karthik", 95); // add
[Link]("Priya", 88);
[Link]([Link]("Karthik")); // 95
[Link]("Priya"); // remove
[Link]([Link]("Karthik")); // true
Collection Allows Duplicates? Ordered? Best Use
ArrayList Yes Yes Dynamic list, access by index
LinkedList Yes Yes Frequent insert/delete
HashSet No No Unique elements only
HashMap Keys: No No Key-Value pairs (like dictionary)
TreeMap Keys: No Sorted Sorted key-value pairs
Chapter 12: Career Tips & Roadmap
3rd Year → Placement Roadmap
Timeline What to do
Now → 1 Month Complete all Java basics (this guide!) + practice 20 programs
Month 2 Learn Data Structures in Java (Arrays, LinkedList, Stack, Queue)
Month 3 Learn Algorithms (Sorting, Searching, Recursion)
Month 4 Practice LeetCode Easy problems (50 problems minimum)
Month 5 Learn Spring Boot basics (for backend developer role)
Month 6 Build 2 projects + Update resume + Apply for jobs
Ongoing Practice 2-3 LeetCode problems every day
Top Companies & What They Ask
Company Interview Focus Difficulty
TCS, Infosys, Wipro Java basics, OOP, simple programs Easy-Medium
Cognizant, Capgemini Java + SQL + basic DS Medium
Zoho Java + problem solving + logical Medium-Hard
HCL, Tech Mahindra Core Java, basic programs Easy
Product companies DSA + Java + System Design Hard
Free Learning Resources
Resource What to use it for Link / Search
Bro Code (YouTube) Best Java beginner tutorial YouTube: "Java Full Course Bro Code"
W3Schools Quick reference while coding [Link]/java
Programiz Simple examples with explanations [Link]/java-programming
LeetCode Practice coding problems [Link]
GeeksForGeeks Java concepts + interview Q&A [Link]
Javatpoint Detailed Java notes [Link]/java-tutorial
■ Golden Rule: Read theory 20% + Write code 80%! Every concept you learn → write it yourself,
don't just copy-paste. Consistency beats intensity — 1 hour daily > 7 hours once a week.
You've got this! Java ■■■■■■■■■■■■, Job ■■■■■■■■■■■! ■■