Summary of "К чему готовиться по Java Core на собеседовании"
High-level summary
This video teaches core Java topics focused on interview preparation: JVM memory and object model, strings and immutability, garbage collection, collections and their complexities, and a brief mention of multithreading. The presenter also references downloadable materials and a paid course.
Core memory and object model
- JVM memory areas:
- Heap — all Java objects (and object fields).
- Metaspace — class metadata, bytecode, static variables/methods.
- Code Cache — JIT-compiled native code.
- Thread stacks — per-thread call stacks and local primitives.
- Note: Some JVM/GC implementations include sub-areas such as string pools or primitive pools.
- Object vs primitive storage:
- Objects live on the heap; threads hold references to them.
- Local primitive variables live on the thread stack.
- Primitives declared as object fields are stored on the heap as part of the object.
- Object creation:
- References to the same object can be shared across threads.
Strings and immutability
- Strings are immutable: operations that modify a string produce new
Stringobjects. - String pool and interning:
- String literals are interned and reused from the pool.
new String(...)creates a new heap object independent of the pool.String.intern()returns the pooled reference (or adds the string to the pool).
- Concatenation and performance:
- Repeated string concatenation can create many temporary
Stringobjects. - Use
StringBuilderfor single-threaded concatenation. - Use
StringBufferwhen thread-safety (synchronization) is required—slower thanStringBuilder.
- Repeated string concatenation can create many temporary
- Designing immutable classes:
- No setters, make fields
final. - Defensively copy mutable internals (e.g., lists) on input and output.
- Immutable objects are thread-safe and safe to use as map keys.
- No setters, make fields
Garbage collection (GC)
- Goal and phases:
- Goal: find unreachable objects (starting from GC roots) and reclaim memory.
- Typical phases: mark reachable objects, then sweep/compact to reclaim space and avoid fragmentation.
- GC roots examples:
- Static variables, active thread stacks (local variables), monitors (locked objects), native references, etc.
- Common collectors:
- Young/Old generational collectors (Serial, Parallel)
- Objects are allocated in Young generation; long-lived objects are promoted to Old generation.
- Young collections are frequent; full collections are rarer.
- G1 (Garbage-First)
- Divides the heap into regions and collects regions with the most garbage first.
- Default in Java 17.
- ZGC
- Low-pause collector designed for very large heaps (up to TBs) and minimal pause times.
- Default in Java 21.
- Young/Old generational collectors (Serial, Parallel)
- Emphasis: collectors partition the heap differently to trade off throughput, latency, and pause times.
Collections overview and complexities
- Structure:
Collectioninterface root →List,Queue,Set.Mapis a separate key→value interface. - Lists:
- ArrayList
- Dynamic array, contiguous memory.
- O(1) get/set, amortized O(1) add-to-end.
- O(n) insert/remove at arbitrary index (shifting elements).
- LinkedList
- Doubly-linked nodes on the heap with prev/next pointers.
- O(1) insert/delete at ends or when you have the node.
- O(n) get/remove/insert by index (must traverse).
- ArrayList
- Queues:
- Deque implementations:
ArrayDeque(array-backed),LinkedList(list-backed). PriorityQueuefor priority ordering.
- Deque implementations:
- Sets:
TreeSet— red-black tree backing, sorted order, O(log n) insert/search.HashSet— hash-based (backed byHashMap), average O(1) operations.LinkedHashSet— preserves insertion order (hash-based + linked list).EnumSet— optimized set for enum types.
- Maps:
TreeMap— red-black tree, sorted keys (requiresComparableor providedComparator).HashMap— hash table, average O(1) lookup/insert; relies on correcthashCode()/equals()implementations.LinkedHashMap— preserves insertion-order or access-order iteration.Hashtable— legacy synchronized map (all methods synchronized); lower performance than modern concurrent maps (java.util.concurrent).
- HashMap internals:
- Hash-based bucket table with chaining (and treeification at high collision rates in modern JDKs).
- Correct
equals()andhashCode()contracts are essential for keys to behave correctly.
Multithreading (brief mention)
- The full material covers multithreading topics: common concurrency problems, synchronization techniques, and typical interview questions about multithreading.
Course / tutorial offers (mentioned in video)
- Free materials:
- 2-hour guide (full version) via link in the description — includes extended topics and multithreading.
- Free recorded interview session (author’s interview that resulted in a job offer).
- Paid course (pre-registration + early discount):
- Over 20 hours of video tutorials covering Java fundamentals through building modern applications.
- Topics include Spring, Hibernate, Spring Boot, Docker, Kafka, microservices, plus core Java.
- Includes homework, code reviews, personal consultations, course chat, resume/job help and interview assistance.
- Promised outcomes: help students secure offers in the ~150–200k RUB range (claimed results shown).
Useful facts likely to be asked at interviews
- JVM memory layout and roles of Heap, Metaspace, Code Cache, and thread stacks.
- Where primitives are stored vs. objects; primitives inside objects are on the heap.
- String immutability, string pool, differences between
new String(...), literals, andintern(). - When to use
StringBuildervsStringBuffer. - How to design an immutable class (no setters, defensive copies,
finalfields). - GC basics: GC roots, mark-and-sweep/compact, generational collection, characteristics of G1 and ZGC.
- Collection internals and time complexities:
ArrayListvsLinkedList,HashMap/HashSetvsTreeMap/TreeSet,LinkedHashMap/LinkedHashSet,Hashtablevs concurrent collections. - Importance of
equals()andhashCode()for hash-based collections and using objects as keys.
Main speaker / source: an experienced Java developer/mentor (unnamed) who shares interview experience, tutorial content, and course offers.
Category
Technology
Share this summary
Is the summary off?
If you think the summary is inaccurate, you can reprocess it with the latest model.
Preparing reprocess...