oop
71 tutorials tagged “oop”.
- Difference Between Abstract Class and InterfaceAbstract class or interface? A full comparison, how to choose, and the skeletal-implementation pattern that uses both, the way the JDK does.
- Abstract Classes and Abstract MethodsA partly built class: abstract methods subclasses must fill in, concrete shared code, constructors, the template method idea, and the compile errors.
- Access Modifiers in Javaprivate, package-private, protected and public: who can reach a class, field or method, the protected subclass rule, and the errors across packages.
- Aggregation in JavaModel a has-a relationship where the parts live on their own: a department that has employees, references as fields, and sharing parts.
- Anonymous Inner Class in JavaDeclare and create a one-off class in a single expression: implementing interfaces, extending classes with arguments, the rules, and lambdas.
- Anonymous ObjectsObjects created and used in one expression without a variable: when they're handy, why you can't reuse them, and how they differ from anonymous classes.
- Association, Aggregation and CompositionThree kinds of object relationship, loosest to strongest: association (uses), aggregation (has, can live apart) and composition (owns).
- Blank Final and Static Final VariablesFinal variables declared without a value: blank finals set in every constructor, blank static finals set in a static block, and the compile errors.
- Difference Between Class and InterfaceA class is a complete blueprint for objects; an interface is a contract. Compare what each can contain, create and inherit, with one example using both.
- Classes and ObjectsHow to write a class with fields and methods, create objects from it with new, give each object its own state, and keep classes in their own files.