Access Modifiers & Visibility
In Java, access modifiers are keywords that set the accessibility (visibility) of classes, constructors, methods, and fields. They are a fundamental aspect of encapsulation, an object-oriented programming principle that allows you to hide internal implementation details and control how other parts of the code can interact with your classes and their members.
Composition Over Inheritance
"Composition over Inheritance" (also known as "favor composition over inheritance") is a design principle in object-oriented programming that suggests that classes should achieve new functionality by composing objects of existing classes (i.e., by containing instances of other classes) rather than by inheriting from them. This principle promotes greater flexibility, reduced coupling, and better code reusability.
Garbage Collection
java-garbage-collector.png
Heap vs. Stack Memory
In the context of the Java Virtual Machine (JVM) and the Java Memory Model (JMM), "Heap" and "Stack" are two fundamental memory regions with distinct purposes, characteristics, and management approaches. Understanding their differences is crucial for comprehending how Java programs execute, manage memory, and handle concurrent operations.
Immutability - final and Defensive Copies
Immutability is a core concept in object-oriented programming, particularly important in Java, which refers to the state of an object remaining unchanged after it has been created. An immutable object is one whose internal state cannot be modified once it has been fully constructed.
Interfaces vs. Abstract Classes
In Java's object-oriented programming (OOP) paradigm, both interfaces and abstract classes provide mechanisms for achieving abstraction and polymorphism. While they share some similarities, their primary purposes, capabilities, and use cases differ significantly.
Java OOP Principles
Object-Oriented Programming (OOP) is a programming paradigm that organizes software design around data, or objects, rather than functions and logic. Java is a purely object-oriented language, meaning almost everything in Java revolves around classes and objects.
Object Equality - equals() and hashCode()
In Java, determining whether two objects are "equal" is a fundamental concept, especially when working with collections. Java provides two methods in the Object class that are crucial for defining and managing object equality: equals() and hashCode(). Understanding their contract and how to override them correctly is vital for robust applications.
SOLID Principles
The SOLID principles are a set of five design principles in object-oriented programming intended to make software designs more understandable, flexible, and maintainable. They were promoted by Robert C. Martin (Uncle Bob) and are widely considered best practices for writing clean, robust, and scalable code.