I started as a trainee in July 2022. If I were starting Java from zero today, with 30 days before my first backend interview, this is the order I would learn it in. This Java roadmap for freshers is opinionated on purpose: fewer topics, more code, and one project you can talk about for 20 minutes without notes.
TL;DR
-
Week 1: Java basics, using the 8 chapters of my beginner series, with code every day.
-
Week 2: methods, OOP, collections and exceptions, the core of a fresher Java interview in my view.
-
Week 3: Streams, then SQL, JDBC, JPA and a Spring Boot REST API, in that order.
-
Week 4: tests, Git, one finished project, and interview prep.
-
Every day: two DSA problems, grouped by pattern.
How long does it take to learn Java for a fresher job?
In my view, with three to four focused hours a day, 30 days is enough to reach a fresher backend interview: core Java, OOP, collections, SQL, a Spring Boot REST API, one finished project and the common DSA patterns. It will not make you an expert. If you have college or a job, give each week two weeks instead.
Four rules before day 1
-
One hour watching, two hours building. Tutorial hell is watching someone else type. If you can't write it without the video, you haven't learned it yet.
-
Type every example. Never copy-paste while learning. Your fingers learn the syntax your eyes skip.
-
One resource per topic. Pick one and finish it. Switching courses at the first hard chapter is how week 1 turns into month 3.
-
Keep a mistakes file. Every compile error and wrong output you hit, one line each: what you wrote, what happened, why. Re-read it on day 30. It becomes the best revision notes you own.
The 30-day Java roadmap for freshers at a glance
|
Week |
Days |
Focus |
You're done when you can... |
|---|---|---|---|
|
1 |
1-7 |
Java basics |
write a 50-line program from a blank file, no tutorial open |
|
2 |
8-14 |
Methods, OOP, collections, exceptions |
model a small domain in classes and explain why HashMap needs |
|
3 |
15-21 |
Streams, SQL, JDBC, JPA, Spring Boot |
build a REST API that reads and writes PostgreSQL |
|
4 |
22-30 |
Tests, Git, one project, interview prep |
demo your project and walk through its code in 5 minutes |
|
Daily |
1-30 |
DSA, two problems |
solve an easy problem in 20 minutes and state its complexity |
Week 1 (days 1-7): Java basics
Week 1 is my Java beginner series, in order. Each chapter ends with practice problems; do all of them before you move on.
-
Day 1: Getting Started with Java: Your First Program Explained. What the JDK, JRE and JVM are, installing JDK 21, and running your first program from IntelliJ and the terminal. Then, the same day, Understanding Java Program Execution: Output, Comments & JVM Basics:
printvsprintln, escape sequences, joining text with+, and the three kinds of comments. -
Day 2: Understanding Variables and Primitive Data Types in Java. Declaring and reassigning variables, the eight primitive types,
finalconstants andvar. -
Day 3: Mastering Operators in Java: Arithmetic, Logical & Relational. Integer division, pre- vs post-increment, short-circuit evaluation and precedence.
-
Day 4: Mastering Type Casting and Type Conversion in Java. Widening, narrowing casts that truncate or overflow,
charandint,Mathhelpers andprintf. -
Day 5: Taking input from the user.
Scanner,nextLine, parsing numbers, and reading aNumberFormatExceptionstack trace to find the bad line. -
Day 6: Decisions with if, else and switch.
if/elseladders, the ternary operator,.equalsfor text, and the modern arrow-styleswitch. -
Day 7: Understanding Loops and Loop Control Statements in Java.
while,for,do-while,break,continue, nested loops and pattern printing.
End-of-week test: from a blank file, write a bill splitter. It reads a total (say ₹1,850) and the number of friends, rejects a count of zero or less, and prints each share to two decimals. If you can do that without opening a chapter, week 1 is done.
Try it yourself: five lines that test week 1
Predict each line of output before you run it.
public class Week1Check { public static void main(String[] args) { System.out.println(1 + 2 + "3" + 4 + 5); System.out.println(7 / 2); System.out.println((int) 3.99); System.out.println('a' + 1); System.out.println((byte) 130); }}[SPOILER: Show the answers]
-
3345. Java evaluates left to right:1 + 2is the number 3, then3 + "3"becomes the String"33", and every+after that joins text. (Chapters 2 and 4) -
3. Both operands areint, so integer division drops the.5. Write7 / 2.0to get3.5. (Chapter 4) -
3. A cast tointtruncates; it never rounds. UseMath.roundwhen you mean rounding. (Chapter 5) -
98. Thechar'a'is 97, andchar + intgives anint. (Chapter 5) -
-126. Abyteholds -128 to 127, so 130 wraps around by 256. (Chapters 3 and 5) [/SPOILER]
Week 2 (days 8-14): methods, OOP, collections, exceptions
-
Day 8: methods, arrays,
StringandStringBuilder. Learn why==can be false for two strings with the same text, and why you build strings inside a loop withStringBuilder. -
Days 9-10: classes and objects, constructors, encapsulation and
static, then inheritance, polymorphism, interfaces and abstract classes. Learnrecordandenumtoo; they are everyday Java now. -
Days 11-12: collections.
List,SetandMap; when to pickArrayList,HashSetorHashMap; sorting withComparableandComparator. ThenequalsandhashCode, and why a key that changes after you insert it breaks a map: Why Your HashMap Suddenly Stops Working (Even Though Nothing Changed). -
Days 13-14: exceptions. Checked vs unchecked,
try-with-resources, custom exceptions, and why an emptycatchblock is a bug waiting to happen.
When I ask a fresher about collections, I listen for the why. "HashMap is O(1)" is a fact anyone can recite. "It's O(1) on average because hashCode picks the bucket, and it degrades when many keys land in one bucket" is understanding.
Week 3 (days 15-21): Streams, SQL and Spring Boot
Day 15: lambdas and Streams. map, filter, collect, groupingBy. Then rewrite three of your week 2 loops as streams and decide honestly which version reads better. Here is the same count both ways, using the records from the project below:
static Map<Status, Integer> countWithLoop(List<Application> apps) { Map<Status, Integer> counts = new HashMap<>(); for (Application app : apps) { Status status = app.status(); counts.put(status, counts.getOrDefault(status, 0) + 1); } return counts;}static Map<Status, Long> countWithStream(List<Application> apps) { return apps.stream() .collect(Collectors.groupingBy(Application::status, Collectors.counting()));}Neither is "better" in general. Be ready to say why you picked one.
-
Day 16: SQL on PostgreSQL.
SELECT,WHERE,JOIN,GROUP BY, indexes, and exactly what a primary key and a unique constraint guarantee. -
Day 17: JDBC. One plain program with a
PreparedStatement. Learn why SQL built by joining strings is an injection risk before a framework hides it from you. -
Day 18: JPA with Spring Data. Entities, repositories, and what the N+1 query problem looks like in the SQL log.
-
Days 19-21: Spring Boot REST. Controllers, request and response records, validation, one
@RestControllerAdvicefor errors, and the right status codes (201, 400, 404, 409). Before you put@Transactionalon anything, read @Transactional Is Lying to You: 7 Ways It Silently Does Nothing in Spring Boot.
Why this order? Spring Boot is JDBC and JPA with the wiring done for you. Learn it first and it feels like magic, and magic is hard to debug and harder to explain in an interview.
Week 4 (days 22-30): tests, Git, one project, interview prep
-
Day 22: JUnit 5 and Mockito. Unit tests for your service layer, one test per rule.
-
Day 23: Git. Branches, small commits with real messages, a pull request into your own repo.
-
Days 24-27: finish the project below. Finish means it runs, it has tests, and the README explains it.
-
Day 28: run it somewhere other than your laptop, and write the README: what it does, how to run it, one diagram.
-
Day 29: your resume line and your "walk me through your project" answer (both below).
-
Day 30: re-read your mistakes file, then do one mock interview with a friend: one DSA problem, one Java concept, one project walkthrough.
The one project: a job application tracker API
Small enough to finish, useful during your own job hunt, and it touches every topic from weeks 2 and 3.
-
Add an application: company, role, status (
APPLIED,INTERVIEW,OFFER,REJECTED) and date. -
List applications, filtered by status, with pagination.
-
Update the status, with rules: for example,
REJECTEDcannot go back toINTERVIEW. -
Reject duplicates: the same company and role twice returns 409 Conflict, enforced by a unique constraint in PostgreSQL, not only by a check in Java.
-
A test for every rule.
Feature 4 is your interview story. A check in Java alone fails when two requests arrive at the same moment, because both pass the check before either inserts. The database constraint is what actually stops the duplicate. If you want to go further, Idempotency Keys in Spring Boot covers the same problem for payments.
The starting point for the API layer:
public record CreateApplicationRequest( @NotBlank String company, @NotBlank String role, @NotNull Status status) {}@RestController@RequestMapping("/api/applications")public class ApplicationController { private final ApplicationService service; public ApplicationController(ApplicationService service) { this.service = service; } @PostMapping public ResponseEntity<Application> create(@Valid @RequestBody CreateApplicationRequest request) { Application created = service.create(request); return ResponseEntity.created(URI.create("/api/applications/" + created.id())).body(created); } @GetMapping public List<Application> list(@RequestParam(required = false) Status status) { return service.list(status); }}Status is the enum above, Application is a record (id, company, role, status), and ApplicationService is yours to write. That is where the rules and the tests live.
DSA alongside, not after
Two problems a day from day 1, about 45 minutes in total. Go by pattern, not by a random list, and say the time and space complexity out loud before you write code.
-
Days 1-7: arrays and strings, using only the loops and conditions from week 1.
-
Days 8-14: hashing and two pointers, now that you know
HashMapandHashSet. -
Days 15-21: sliding window, stack and binary search.
-
Days 22-30: recursion, linked lists, binary trees, and revision of everything you got wrong.
Three good first sliding window problems for week 3:
How to show it on your resume
Before: Job tracker using Spring Boot.
After: Job application tracker REST API (Java 21, Spring Boot 3, PostgreSQL). Blocked duplicate applications with a database unique constraint (409 on conflict). Unit-tested every status rule with JUnit 5 and Mockito. GitHub link.
The second line hands the interviewer three questions to ask you, and you have prepared answers to all three. My rules for a fresher's project line: what it does, the one hard problem, how you tested it. And don't list a skill you can't answer two questions about.
Before you apply
-
I can write a Java program from a blank file without a tutorial open
-
I can explain how HashMap uses
equalsandhashCode, and why keys must not change -
I can write a
JOINand aGROUP BYwithout looking them up -
My project runs from its README on a fresh machine
-
My project has tests, and I can explain one I wrote
-
I have solved at least 40 DSA problems across 8 or more patterns
-
I can walk through my project in 60 seconds and in 5 minutes
-
My resume names one hard problem I solved
Walk me through your project.
The structure: what it is, the stack, the hard problem, how you solved it, how you tested it, what you would do next.
A sample answer: "I built a job application tracker: a REST API in Java 21 and Spring Boot 3 with PostgreSQL. You can add applications, filter them by status and move them through stages. The interesting part was duplicates. My first version checked in Java whether the company and role already existed, but two quick requests could both pass that check. So I added a unique constraint in PostgreSQL and mapped the violation to a 409 Conflict. I also blocked invalid status changes, like REJECTED back to INTERVIEW, and wrote a unit test for each rule. Next, I'd add login so each user sees only their own applications."
What to read next
-
Getting Started with Java: Your First Program Explained: day 1 of this roadmap. Start here.
-
Why Your HashMap Suddenly Stops Working (Even Though Nothing Changed): the week 2 bug that shows up in interviews and in production.
-
@Transactional Is Lying to You: 7 Ways It Silently Does Nothing in Spring Boot: read it in week 3, before your first service method.




Discussion