☕
TechLearn
Java Tutorial
Back to Home
What is Java?Features of JavaUses of JavaJava Editions (Java SE, EE, ME)JDK, JRE and JVMJava ArchitecturePlatform IndependenceBytecodeHow Java WorksFirst Java ProgramJava Compilation ProcessJava Execution FlowJava InstallationSetting JAVA_HOMEJava Environment SetupJava Naming ConventionsJava KeywordsJava Reserved WordsJava IdentifiersJava Unicode SystemJava CommentsJava Coding Standards
Variables in JavaData Types in JavaPrimitive Data TypesNon-Primitive Data TypesLiteralsType CastingWidening CastingNarrowing CastingOperatorsArithmetic OperatorsRelational OperatorsLogical OperatorsBitwise OperatorsAssignment OperatorsUnary OperatorsTernary Operatorinstanceof OperatorInput and OutputScanner ClassBufferedReaderConsole Inputprintf()Escape SequencesCommand Line Arguments
Control Statementsif Statementif-else StatementNested ifswitch Statementswitch Expressionfor Loopwhile Loopdo-while LoopEnhanced for Loopbreak Statementcontinue Statementreturn Statement
OOP ConceptsClassesObjectsObject CreationDefault ConstructorParameterized ConstructorConstructor OverloadingCopy Constructorthis Keywordstatic Keywordfinal KeywordAccess ModifiersEncapsulationSingle InheritanceMultilevel InheritanceHierarchical InheritanceMethod Overridingsuper KeywordCompile-time PolymorphismRuntime PolymorphismAbstractionAbstract ClassInterfaceMultiple Inheritance using InterfaceAssociationAggregationCompositionObject ClassAnonymous ObjectInitialization BlocksNested ClassesInner ClassesAnonymous Inner ClassesStatic Nested Classes
Array BasicsOne-Dimensional ArrayTwo-Dimensional ArrayMultidimensional ArrayJagged ArrayArray InitializationArray TraversalArray SortingArray SearchingArrays ClassCopying ArraysPassing Arrays to MethodsReturning Arraysvarargs
String ClassString PoolImmutable StringMutable StringString MethodsString Comparisonequals() vs ==StringBufferStringBuilderStringTokenizerStringJoinerText BlocksUnicode HandlingRegular ExpressionsPattern ClassMatcher Class
Exception Basicstry-catchMultiple catchfinallythrowthrowsCustom ExceptionChecked ExceptionUnchecked ExceptionError vs ExceptionStack Tracetry-with-resourcesException PropagationChained Exceptions
Package ConceptBuilt-in PackagesUser-defined PackagesimportStatic ImportPackage ProtectionJAR FilesManifest File
Stack MemoryHeap MemoryMetaspaceJVM Memory ModelGarbage CollectionGC AlgorithmsMemory Leakfinalize()Reference Types (Weak, Soft, Phantom)
Collections OverviewIterableCollection InterfaceArrayListLinkedListVectorStackQueue InterfacePriorityQueueDequeArrayDequeHashSetLinkedHashSetTreeSetSortedSetNavigableSetHashMapLinkedHashMapTreeMapHashtableConcurrentHashMapWeakHashMapIdentityHashMapEnumMapCollections ClassComparableComparatorIteratorListIteratorSpliteratorFail-Fast vs Fail-SafeImmutable CollectionsSynchronized Collections
Generic ClassGeneric MethodType ParametersBounded TypesWildcardsUpper BoundLower BoundType ErasureGeneric InterfaceRaw Types
Process vs ThreadThread BasicsCreating ThreadsThread LifecycleThread PriorityThread SchedulerSynchronizationsynchronized KeywordInter-thread Communicationwait()notify()notifyAll()DeadlockRace ConditionStarvationThread SafetyvolatileAtomic VariablesExecutors FrameworkThread PoolFutureCompletableFutureForkJoinPoolLocks APIReentrantLockReadWriteLockSemaphoreCountDownLatchCyclicBarrierPhaserParallel StreamsVirtual Threads
I/O BasicsByte StreamsCharacter StreamsFile HandlingFile ClassFileInputStreamFileOutputStreamBuffered StreamsFileReaderFileWriterBufferedReaderBufferedWriterPrintWriterDataInputStreamDataOutputStreamSerializationDeserializationtransientExternalization
NIO OverviewPathFiles ClassChannelsBuffersWatchService
Lambda ExpressionsFunctional InterfacesPredicateFunctionConsumerSupplierMethod ReferencesStream APIIntermediate OperationsTerminal OperationsOptionalDefault MethodsStatic Interface MethodsDate Time APIBase64Parallel Streams
Module System (JPMS)JShellCollection Factory MethodsPrivate Interface Methodsvar KeywordHTTP Client APIString ImprovementsSwitch ExpressionsText BlocksPattern MatchingRecordsSealed ClassesPattern Matching for switchRecord PatternsSequenced CollectionsVirtual ThreadsStructured ConcurrencyScoped Values
Functional Programming BasicsPure FunctionsHigher Order FunctionsClosuresCurryingImmutable ProgrammingStream Pipelines
LocalDateLocalTimeLocalDateTimeZonedDateTimePeriodDurationDateTimeFormatterTime ZonesLegacy Date APICalendar
JDBC ArchitectureJDBC DriversDriverManagerConnectionStatementPreparedStatementCallableStatementResultSetTransactionsBatch ProcessingConnection PoolingMetadataRowSetStored Procedures
319 topics covered
☕
TechLearn
Java Tutorial
Back to Home
What is Java?Features of JavaUses of JavaJava Editions (Java SE, EE, ME)JDK, JRE and JVMJava ArchitecturePlatform IndependenceBytecodeHow Java WorksFirst Java ProgramJava Compilation ProcessJava Execution FlowJava InstallationSetting JAVA_HOMEJava Environment SetupJava Naming ConventionsJava KeywordsJava Reserved WordsJava IdentifiersJava Unicode SystemJava CommentsJava Coding Standards
Variables in JavaData Types in JavaPrimitive Data TypesNon-Primitive Data TypesLiteralsType CastingWidening CastingNarrowing CastingOperatorsArithmetic OperatorsRelational OperatorsLogical OperatorsBitwise OperatorsAssignment OperatorsUnary OperatorsTernary Operatorinstanceof OperatorInput and OutputScanner ClassBufferedReaderConsole Inputprintf()Escape SequencesCommand Line Arguments
Control Statementsif Statementif-else StatementNested ifswitch Statementswitch Expressionfor Loopwhile Loopdo-while LoopEnhanced for Loopbreak Statementcontinue Statementreturn Statement
OOP ConceptsClassesObjectsObject CreationDefault ConstructorParameterized ConstructorConstructor OverloadingCopy Constructorthis Keywordstatic Keywordfinal KeywordAccess ModifiersEncapsulationSingle InheritanceMultilevel InheritanceHierarchical InheritanceMethod Overridingsuper KeywordCompile-time PolymorphismRuntime PolymorphismAbstractionAbstract ClassInterfaceMultiple Inheritance using InterfaceAssociationAggregationCompositionObject ClassAnonymous ObjectInitialization BlocksNested ClassesInner ClassesAnonymous Inner ClassesStatic Nested Classes
Array BasicsOne-Dimensional ArrayTwo-Dimensional ArrayMultidimensional ArrayJagged ArrayArray InitializationArray TraversalArray SortingArray SearchingArrays ClassCopying ArraysPassing Arrays to MethodsReturning Arraysvarargs
String ClassString PoolImmutable StringMutable StringString MethodsString Comparisonequals() vs ==StringBufferStringBuilderStringTokenizerStringJoinerText BlocksUnicode HandlingRegular ExpressionsPattern ClassMatcher Class
Exception Basicstry-catchMultiple catchfinallythrowthrowsCustom ExceptionChecked ExceptionUnchecked ExceptionError vs ExceptionStack Tracetry-with-resourcesException PropagationChained Exceptions
Package ConceptBuilt-in PackagesUser-defined PackagesimportStatic ImportPackage ProtectionJAR FilesManifest File
Stack MemoryHeap MemoryMetaspaceJVM Memory ModelGarbage CollectionGC AlgorithmsMemory Leakfinalize()Reference Types (Weak, Soft, Phantom)
Collections OverviewIterableCollection InterfaceArrayListLinkedListVectorStackQueue InterfacePriorityQueueDequeArrayDequeHashSetLinkedHashSetTreeSetSortedSetNavigableSetHashMapLinkedHashMapTreeMapHashtableConcurrentHashMapWeakHashMapIdentityHashMapEnumMapCollections ClassComparableComparatorIteratorListIteratorSpliteratorFail-Fast vs Fail-SafeImmutable CollectionsSynchronized Collections
Generic ClassGeneric MethodType ParametersBounded TypesWildcardsUpper BoundLower BoundType ErasureGeneric InterfaceRaw Types
Process vs ThreadThread BasicsCreating ThreadsThread LifecycleThread PriorityThread SchedulerSynchronizationsynchronized KeywordInter-thread Communicationwait()notify()notifyAll()DeadlockRace ConditionStarvationThread SafetyvolatileAtomic VariablesExecutors FrameworkThread PoolFutureCompletableFutureForkJoinPoolLocks APIReentrantLockReadWriteLockSemaphoreCountDownLatchCyclicBarrierPhaserParallel StreamsVirtual Threads
I/O BasicsByte StreamsCharacter StreamsFile HandlingFile ClassFileInputStreamFileOutputStreamBuffered StreamsFileReaderFileWriterBufferedReaderBufferedWriterPrintWriterDataInputStreamDataOutputStreamSerializationDeserializationtransientExternalization
NIO OverviewPathFiles ClassChannelsBuffersWatchService
Lambda ExpressionsFunctional InterfacesPredicateFunctionConsumerSupplierMethod ReferencesStream APIIntermediate OperationsTerminal OperationsOptionalDefault MethodsStatic Interface MethodsDate Time APIBase64Parallel Streams
Module System (JPMS)JShellCollection Factory MethodsPrivate Interface Methodsvar KeywordHTTP Client APIString ImprovementsSwitch ExpressionsText BlocksPattern MatchingRecordsSealed ClassesPattern Matching for switchRecord PatternsSequenced CollectionsVirtual ThreadsStructured ConcurrencyScoped Values
Functional Programming BasicsPure FunctionsHigher Order FunctionsClosuresCurryingImmutable ProgrammingStream Pipelines
LocalDateLocalTimeLocalDateTimeZonedDateTimePeriodDurationDateTimeFormatterTime ZonesLegacy Date APICalendar
JDBC ArchitectureJDBC DriversDriverManagerConnectionStatementPreparedStatementCallableStatementResultSetTransactionsBatch ProcessingConnection PoolingMetadataRowSetStored Procedures
319 topics covered
Home/Java/Java Memory Management
☕ Java

Java Memory Management

9 lessons in this section of the Java tutorial. Work through them in order, or jump to the one you need.

  1. 1.Stack Memory

    Stack memory is the region of memory where the JVM stores method invocation frames, local variables, and partial results.

  2. 2.Heap Memory

    The heap is the runtime data area from which all Java object instances and arrays are allocated.

  3. 3.Metaspace

    Metaspace is the JVM memory region that stores class metadata — the internal representations of loaded classes, methods, fields, constant pools, and annotations.

  4. 4.JVM Memory Model

    The JVM Memory Model encompasses two related but distinct concepts.

  5. 5.Garbage Collection

    Garbage collection is the automatic process by which the JVM reclaims memory occupied by objects that are no longer reachable from the running program.

  6. 6.GC Algorithms

    Garbage collection algorithms are the strategies the JVM uses to identify and reclaim unreachable objects.

  7. 7.Memory Leak

    A memory leak in Java occurs when objects that are no longer needed by the application remain reachable through strong references, preventing the garbage collector from…

  8. 8.finalize()

    The finalize() method was a mechanism for performing cleanup on objects before they were garbage collected.

  9. 9.Reference Types (Weak, Soft, Phantom)

    Java provides four reference strengths beyond the ordinary strong reference: strong (the default), soft, weak, and phantom.

← Packages and Access ControlCollections Framework →
TechLearn

Free Java and Spring Boot tutorials for developers, written by Ajeet Kumar.

Tutorials

  • Java Tutorial
  • Spring Boot Tutorial

About & Legal

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Disclaimer

© 2026 TechLearn. All rights reserved.