Class
A class is a blueprint for objects and defines a type with fields and methods.
Related concepts: ObjectFieldMethodMemberTypePrototype
Closest Wikipedia entry: Class (computer programming) — In object-oriented programming, a class defines the shared aspects of objects created from the class. The capabilities of a class differ between programming languages, but generally the shared aspects consist of state (variables) and behavior (methods) that are each either associated with a particular object or with all objects of that class. Object state can differ between each instance of the class whereas the class state is shared by all of them.
Misconceptions about Class28 documented Misconceptions
Check YourselfAbstractClassMustImplementAbstractMethod
An abstract class must implement all abstract methods defined in its superclassAbstractClassNoImplementation
An abstract class cannot contain implemented methodsAddMemberAtRuntime
Set of class members can change at runtimeAllClassesHaveDefaultConstructor
All classes automatically get a no-argument constructorAnyClassException
Any class can be an exception classArrayListIsArray
ArrayLists are arraysCallNotStaticallyChecked
A method invocation on a reference of a type that does not have that method won't compileConcreteClassMustOverride
A concrete class needs to implement all methods declared in its abstract superclassesConcreteClassOnlyImplementClassAbstract
A concrete class only needs to implement those abstract methods it inherits from abstract superclassesConcreteClassOnlyImplementDirectAbstract
A concrete class only needs to implement abstract methods declared in its direct supertypesConcreteClassOnlyImplementInterfaceAbstract
A concrete class only needs to implement those abstract methods it inherits from interfacesImmutableRequiresFinalParameters
Immutable classes need final constructor/method parametersImplicitInterfaceImplementation
Java implicitly produces implementations of any methods a class inherits from the interfaces it implementsInterfaceExtendClass
An interface can extend a classMethodAsField
Each object contains its own special fields for all of its methodsMethodsWithoutClass
Methods can be defined outside a classMultipleSuperclasses
A class can have multiple superclassesNestedObjectsImplyNestedClasses
If objects are part of a containment hierarchy, their classes are nested, tooNoFieldInheritance
An object contains only the fields declared in its classNoMethodInheritance
Subclasses inherit fields but not methodsPrivateFieldsImplyImmutability
A class where all fields are private is immutableReferringToRecursiveStructureMakesRecursive
A class referring to a recursive data structure is (indirectly) part of that recursion as wellSetterIsStatic
Setter methods are staticSuperclassObjectAllocated
When instantiating an object of a subclass, an object of a superclass is also allocatedUnqualifiedNamesMustDiffer
The unqualified names of different classes must be differentUseOfSelfTypeImpliesRecursiveType
If a class has a method that has a local variable, parameter, or return value with the class as its type, the class is a recursive type