🔤 Arc A — Java Fundamentals

Core syntax: type declarations, string utilities, control flow, loops, arrays, and StringBuilder. These patterns appear in every arc and every interview.

javac Fundamentals.java && java Fundamentals
Fundamentals.javaArc A · Lessons 1–8
verified output
grade = B result = Java Backend 21 sorted = [1, 3, 5, 8]

🏛️ Arc B — OOP

Records, classes, interfaces, abstract classes, inheritance, encapsulation, and method overriding — the building blocks of every Spring Boot service.

javac OopDemo.java && java OopDemo
OopDemo.javaArc B · Lessons 9–14
verified output
Compiled OK 5.0 78.53981633974483 [INFO] Circle r=5.0 12.566370614359172

⚡ Arc C — Functional & Modern Java

Collections, generics, lambdas, method references, Stream pipelines, Optional, try-with-resources, and custom exceptions.

javac FunctionalDemo.java && java FunctionalDemo
FunctionalDemo.javaArc C · Lessons 15–22
verified output
MEERA ARJUN LAKSHMI filtered = [Arjun, Lakshmi, Meera] val = Arjun

🌱 Arc D — Spring Boot

Application bootstrap, REST controllers, dependency injection, validation, error handling, security, and config management.

./mvnw spring-boot:run
SpringAnnotations.javaArc D · Lessons 23–29
cat src/main/resources/application.properties
application.propertiesArc D · key config lines

🗄️ Arc E — Databases

JPA entities, relationships, Spring Data repositories, JPQL queries, transactions, and raw JdbcTemplate access.

./mvnw test -Dtest=EmployeeRepositoryTest
JpaEntities.javaArc E · Lessons 30–33
cat src/main/resources/data.sql
JdbcTemplate + data.sqlArc E · raw JDBC access

🧪 Arc F — Testing

Unit tests with JUnit 5 and Mockito — from basic assertions to parameterized tests and mock verification.

./mvnw test
JUnit5Examples.javaArc F · Lessons 34–36 — JUnit 5
MockitoExamples.javaArc F · Lessons 34–36 — Mockito

🤖 Arc G — Java + AI

Calling Ollama with the Java HttpClient, using Spring RestClient, building a simple RAG retrieval step, and templating prompts with a PromptTemplate record.

javac OllamaClient.java && java OllamaClient
OllamaClient.javaArc G · Lessons 37–39 — HttpClient + Ollama
SpringAiUtils.javaArc G · Lessons 37–39 — RestClient, RAG, PromptTemplate

📋 Quick Reference Table

Ten concepts you must know cold for Java backend interviews.

Concept Annotation / Class Arc Key Method / Usage
REST Controller @RestController D @GetMapping, @PostMapping, @PathVariable
Service Layer @Service D @Autowired repo; business logic; called by controller
JPA Entity @Entity E @Id, @GeneratedValue, @ManyToOne
JPA Repository JpaRepository<T,ID> E findAll(), findById(), save(), delete()
Transaction @Transactional E rolls back on RuntimeException; use on service methods
Mock Object @Mock F when(mock.method()).thenReturn(val)
Unit Test @Test F assertEquals, assertThrows, assertAll
Stream Pipeline Stream<T> C filter(), map(), collect(), groupingBy()
HTTP Client HttpClient G HttpRequest.newBuilder(), client.send()
REST Client RestClient G rest.post().uri().body().retrieve().body()

✅ Key Takeaways

  • Prefer record for immutable data carriers; use class when you need mutability or inheritance.
  • Stream pipelines are lazy — no work happens until a terminal operation (collect, count, forEach) is called.
  • Spring's three-tier pattern — @RestController → @Service → @Repository — separates concerns and makes every layer independently testable.
  • @Transactional on a service method enlists all repository calls in one ACID transaction; an unchecked exception triggers an automatic rollback.
  • With Mockito, always verify that mock interactions happened the expected number of times using verify(mock, times(n)).method() or verify(mock, never()).method().
  • Any Java app can call a local LLM via the built-in HttpClient; Spring Boot apps can use RestClient for a cleaner, fluent API.
Africa & India's Best AI Academy
🤖 AI-first 🎓 Placement Assistance

Ready to build Java AI services?

Join the Best AI Programs — three 5-month courses, fully online, with placement assistance. Week 1 is free.

Explore our AI-era courses →