Type

A type is a set of values supporting a certain set of operations.

Related concepts:  ValueClass

Closest Wikipedia entry:  Type system — In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type (for example, integer, floating point, string) to every term (a word, phrase, or other set of symbols). Usually the terms are various language constructs of a computer program, such as variables, expressions, functions, or modules. A type system dictates the operations that can be performed on a term.

Authoritative Definition

Wikipedia does not necessarily offer the best fitting definition of a concept. The exact meaning we attribute to the concept of Type is based on principled authoritative sources such as:

Misconceptions about Type
38 documented Misconceptions

Check Yourself
Misconception
ArrayElementTypeRepeatsJava
The type of a multi-dimensional array is written as T[] T[] T[]
Misconception
ArrayElementsUntypedJava
Elements of arrays are untyped
Misconception
ArrayLengthPartOfTypeJava
The length of an array is part of its type
Misconception
ArrayRankNotPartOfTypeJava
The rank of an array is not part of its type
Misconception
CharNotNumericJava
Char is not a numeric type
Misconception
CharTypeJavaScript
A single character is of type char
Misconception
ClassDefinesTypeJavaScript
The type of an object is equivalent to the type defined by its class definition
Misconception
CompositeExpressionsUntypedJava
Expressions that consist of multiple parts have no type
Misconception
EqualityOperatorComparesOnlyTypesJavaScript
The equality operator '==' compares only the types of the operands
Misconception
EqualityOperatorComparesOnlyTypesScratch
() = () compares only the types of its operands
Misconception
ExpressionsDynamicallyTypedJava
One has to evaluate an expression to determine its type
Misconception
IntegerDivisionToRationalJava
Dividing two integers can produce a rational number
Misconception
LargeIntegerLongJava
Large integer numbers have type long
Misconception
ListsHomogeneousScratch
All items in a list must have the same type
Misconception
MethodWithoutReturnTypeJava
A method declaration does not need to include a return type
Misconception
NamedTypeParameterJava
To instantiate a generic type, one needs to specify type parameter names as well as types
Misconception
NoCastIfSameSizeJava
If a variable is at least as big (bit-width) as a value, then no cast is needed to a assign the value to the variable
Misconception
NoFloatLiteralsJava
There are no float literals
Misconception
NoImplicitWideningJava
Smaller types are never automatically converted into bigger ones without an explicit cast
Misconception
NoLongLiteralsJava
There are no long literals
Misconception
NullAndUndefinedAreTheSameJavaScript
The values null and undefined are the same
Misconception
NumericToBooleanCoercionJava
Numeric types can be coerced to boolean
Misconception
PrimitiveTypeParameterJava
Type parameters of generic types can be assigned primitive types
Misconception
PrimitiveVariablesDynamicallyTypedJava
The type of a primitive variable depends on its value
Misconception
RecursiveMethodImpliesRecursiveTypeJava
A class with a recursive method represents part of a recursive data structure
Misconception
ReferenceLabeledWithDynamicTypeJava
In stack and heap diagrams, reference variables are labeled with the types of the objects they refer to
Misconception
ReferenceToBooleanCoercionJava
Every reference type can be coerced to boolean
Misconception
ReferenceToIntegerConversionJava
One can cast between references and ints
Misconception
StaticCallPolymorphicJava
A static method call is dispatched polymorphically at runtime based on the argument types
Misconception
SubtypeCompatibleWithSupertypeJava
A variable of a subtype can reference an object of a supertype
Misconception
SupertypeIncompatibleWithSubtypeJava
A variable of a supertype cannot reference an object of a subtype
Misconception
TargetTypingJava
The type of a numerical expression depends on the type expected by the surrounding context
Misconception
TypeofArrayIsArrayJavaScript
The typeof operator applied on an array returns 'array'
Misconception
TypeofNullIsNullJavaScript
The value null is of type 'null'
Misconception
UntypedVariablesJava
Variable declarations don't need a type
Misconception
UseOfSelfTypeImpliesRecursiveTypeJava
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
Misconception
VoidMethodNotRecursiveJava
A method with void return type can't be recursive
Misconception
VoidMethodReturnsValueJava
A method with void return type can return a value

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.