Hackathon Prep
Bootcamp

Core Java · Collections · Spring Boot · MySQL


Delivered by Aditya Dua

Sr. Manager, Field Services — GitHub India

KL University · Skill Development Division  |  110 Industry Problems →

What This Session Is

✔ You will learn

Problem framing skills
Core Java patterns
Architecture thinking
How to design before coding

✗ This is NOT

A syntax tutorial
A live coding marathon
Feature overload
Finishing implementation today

"AI can write the code. But it can't do the thinking for you."

The session mantra

Make it clear
→ Make it correct
→ Make it clean

Pick Your Track

Choose based on your comfort level — both tracks lead to a valid submission

☕

Java Track

Build a solid, well-tested core Java solution

✔ Core Java logic
✔ Collections
✔ OOP & Exception handling
✔ Console I/O

Module A / B problems

🚀

Full-Stack Track

Build a REST API backed by a real database

✔ Everything in Java Track
✔ Spring Boot REST API
✔ MySQL schema + JPA
✔ Layered architecture

Module C+ problems

Problem Framing

Convert any statement into an engineering contract

PointQuestion
InputsWhat data comes in?
OutputsWhat must be produced?
RulesWhat business logic applies?
Edge CasesWhere can logic break silently?
ConstraintsAny limits on values or formats?
AssumptionsWhat are you assuming when unstated?

⚡ Rule: If a team can't state inputs/outputs in 2 minutes — they are NOT ready to code

🐛 Spot the Bug

What does this print?

int marks = 450;
int total = 500;
System.out.println("Percentage: " + marks/total * 100);
  • A) 90
  • B) 90.0
  • C) 0
  • D) Compilation Error

OOP — Class, Inheritance & Subclass

🏗 Use a Class when

Multiple fields + behavior belong together
Employee — name, salary, computePay()

🧬 Use Inheritance when

"IS-A" relationship exists
SavingsAccount IS-A Account

🔧 Use Subclass when

Behavior differs by type
FDAccount lock-in vs CurrentAccount overdraft

IS-A → Inheritance
Dog IS-A Animal  ·  SavingsAccount IS-A Account
HAS-A → Composition
Car HAS-A Engine  ·  Employee HAS-A Address

Collections — The Hidden MVP

NeedUseExample
Ordered itemsList<T>Cart, price ticks, log lines
No duplicatesSet<T>Unique customers, keywords
Key→Value lookupMap<K,V>Word counts, category rates
FIFO queueQueue<T>ATM queue, task scheduler
💡 Choose by behavior, not by habit.

🧩 Quiz — Pick the Right Collection 4 Rounds

Click an answer — can you go 4/4? 🎯

Q1: You're storing which state belongs to which country. What do you use?

  • A) List
  • B) Set
  • C) Map<String, String>
  • D) Queue

🧩 Quiz — Round 2

Q2: You want to track all unique students who visited the library today. What do you use?

  • A) List — it keeps order!
  • B) Set — no duplicates needed
  • C) Map — key-value pair
  • D) Array — simple and fast

🧩 Quiz — Round 3

Q3: Students are standing in a canteen queue — first come, first served. What do you use? 🍱

  • A) List — I use it for everything 😅
  • B) Set
  • C) Map
  • D) Queue — FIFO!

🧩 Quiz — Round 4

Q4: You want to keep your Swiggy order history in the order you placed them. What do you use? 🍕

  • A) List — ordered & allows duplicates
  • B) Set — unique orders only
  • C) Map — need a key for each order
  • D) Queue — I'll eat in order 😂

Spring Boot — Client-Server Architecture

🌐 Client — Browser / Mobile / Postman
↕ HTTP (JSON)

☕ Spring Boot Server

🎯 Controller — routes & validates
↕
⚙️ Service — ALL business logic lives here
↕
🗄 Repository — only fetches & saves
↕ SQL (JPA)
🐬 MySQL Database — persists data

Spring Boot — Code Skeleton

Controller (thin — no logic!)

@RestController
@RequestMapping("/api/submissions")
public class SubmissionController {
  @Autowired SubmissionService svc;

  @PostMapping
  public ResponseEntity create(
      @RequestBody Submission s) {
    return ResponseEntity.ok(
        svc.create(s));
  }
}

Service (logic owner)

@Service
public class SubmissionService {
  @Autowired SubmissionRepository repo;

  public Submission create(Submission s) {
    if (s.getStudentName() == null)
      throw new IllegalArgumentException(
          "Name required");
    s.setStatus("SUBMITTED");
    return repo.save(s);
  }
}

🏗 Quiz — Which Layer? Interactive

Q1: Your code checks "if score > 40, student passes". Where does this go?

  • A) Controller — it's important!
  • B) Service — business logic lives here
  • C) Repository — save it to DB
  • D) main() method 😅

Q2: A waiter in a restaurant is like which Spring Boot layer? 🍽

  • A) Controller — takes order, delivers food
  • B) Service — the chef cooking
  • C) Repository — the fridge storing ingredients
  • D) MySQL — the pantry

Integration Blueprint

✅ Happy Path

1. Request arrives at Controller
2. Controller validates required fields
3. Service checks business rules
4. Repository saves to MySQL
5. Return 200 OK + data

❌ Error Paths

Missing field → 400 Bad Request
Rule violated → 422 + message
Not found → 404
DB error → 500

⚡ Design happy path AND failure path together.

☕

See You Tomorrow Morning

"The best engineers don't just write code —
they make the machine think what they thought."

Tonight: think deeply.
Tomorrow: build fast.
Always: ship something real.


— Aditya Dua · Sr. Manager, Field Services · GitHub India