Title: Theory / Unimportant / CS / Programming / Java / Type
Tags: FromInstruction computer_to_instruction hasNotNewEffectReturnsMeaning type hasSeenConjDef
On every note of this deck, unless a note says otherwise:
Chapter: 4

Name: Type
Definition: PrimitiveType
Page: 41
Section: 1
Definition2: ReferenceType
Conjdef: Either
Definition3: null type (no name)

Name: FloatingPointType
Definition: one of float double
Page: 41
Section: 1

Name: IntegralType
Definition: (one of)
byte short int long char
Page: 41
Section: 1

Name: NumericType
Definition: IntegralType
FloatingPointType
Page: 41
Section: 1
Conjdef: Either

Name: PrimitiveType
Definition: {Annotation} NumericType
Page: 41
Section: 2
Context: JVM
Definition2: {Annotation} boolean
Conjdef: Either
Definition3: returnAddress (only in JVM, not in java)
Intuition: A type of a value which is not an object; do not use pointer to access it

Typ: byte
Meaning: \(-2^{-7}\) to \(2^7-1\)
Page: 41
Language: java
Chapter: 4
Section: 2.1

Typ: short
Meaning: \(-2^{15}\) to \(2^{15}-1\)
Page: 41
Language: java
Chapter: 4
Section: 2.1

Typ: char
Meaning: from \(0\) to \(2^{16}\)
Page: 41
Language: java
Chapter: 4
Section: 2.1

Question: Exceptions which can be sent by arithmetic operations
Answer: NullPointerException
Page: 44
Chapter: 4
Section: 2.2
Answer2: ArithmeticException for /0 and %0
Answer3: OutOfMemoryError

Typ: float
Meaning: single precision 32-bit IEEE 754 values
Page: 45
Language: java
Chapter: 4
Section: 2.3

Typ: double
Meaning: double precision 64-bit IEEE 754 values
Page: 45
Language: java
Chapter: 4
Section: 2.3

Name: normal form of a floating-point number
Definition: \(s\) is +1 or -1
Page: 45
Section: 2.3
Definition2: \(2^{N-1}\le m<2^{N}\) for \(N\) a parameter
Conjdef: \(s\cdot m\cdot 2^{e-N+1}\) with
Definition3: \(8(2^{K-1}-2)\le e<2^{K-1}\) for \(K\) a parameter

Name: A denormalized form of a floating-point number
Definition: \(m<2^{N-1}\)
Page: 45
Section: 2.3
Conjdef: \(s\cdot m\cdot 2^{e-N+1}\) with

Question: What is the arithmetic relations between -0. and 0.
Answer: They test as equal.
Page: 45
Chapter: 4
Section: 2.3
Answer2: When it is a denominator, they don't lead to the same infinity
Answer3: Neither is smaller than the other

Question: What is the arithmetic result of an operation on NaN
Answer: If the result is arithmetic, it will be NaN
Page: 45
Chapter: 4
Section: 2.3
Answer2: Each comparison return false, even compared to NaN. Except for != which returns true

Question: What is the result of adding integer and float
Answer: float
Page: 48
Chapter: 4
Section: 2.4

Question: What is the result of adding numeric and string
Answer: string
Page: 48
Chapter: 4
Section: 2.4

Question: What is the result of arithmetic operation on floating of two different size
Answer: lowest size is converted to greatest size
Page: 48
Chapter: 4
Section: 2.4

Question: Difference between java floating point and IEE754
Answer: remained operator only
Page: 50
Chapter: 4
Section: 2.4

Question: What is java rounding rule for float ?
Answer: Rounding is done to the closest representable value of the real result. If the real result is the mean of two closest representable value, the one with least significant bit 0 is chosen
Page: 49
Chapter: 4
Section: 2.4

Question: What is java rounding rule from float to int
Answer: round toward zero
Page: 49
Chapter: 4
Section: 2.4

Question: What is java float overflow result
Answer: infinity
Page: 49
Chapter: 4
Section: 2.4

Question: What is java float underflow result
Answer: either denormalized value or signed zero
Page: 49
Chapter: 4
Section: 2.4

Question: What is java float result for operation without mathematically definite result ?
Answer: NaN
Page: 49
Chapter: 4
Section: 2.4

Question: What is java result for arithmetic over distinct integral types ?
Answer: Type of lowest precision is converted to highest precision, and arithmetic is done
Page: 44
Chapter: 4
Section: 2.3

Question: What is result of adding string and boolean
Answer: boolean is converted to String
Page: 44
Chapter: 4
Section: 2.3

Question: Boolean value of numeric variables
Answer: 0 is false, everything else is true
Page: 44
Chapter: 4
Section: 2.3

Question: Boolean value of object variables
Answer: null is false, everything else is true
Page: 44
Chapter: 4
Section: 2.3

Name: Dims
Definition: {Annotation} [ ] {{Annotation} [ ] }
Page: 53
Section: 3

Name: ArrayType
Definition: PrimitiveType Dims
Page: 53
Section: 3
Definition2: ClassOrInterfaceType Dims
Conjdef: Either
Definition3: TypeVariable Dims

Name: TypeVariable
Definition: {Annotation} TypeIdentifier
Page: 53
Section: 3

Name: InterfaceType
Definition: ClassType
Page: 53
Section: 3

Name: ClassType
Definition: {Annotation} TypeIdentifier [TypeArguments]
Page: 53
Section: 3
Definition2: PackageName . {Annotation} TypeIdentifier [TypeArguments]
Definition3: ClassOrInterfaceType . {Annotation} TypeIdentifier [TypeArguments]

Name: ClassOrInterfaceType
Definition: ClassType or InterfaceType
Page: 53
Section: 3

Name: ReferenceType
Definition: ClassOrInterfaceType
Page: 53
Section: 3
Context: Java
Definition2: TypeVariable
Conjdef: Either
Definition3: ArrayType

Name: parameterized type
Definition: C a generic type
Page: 53, 59
Section: 3, 5
Definition2: T_i a list of type arguments
Conjdef: a type where type arguments appear, of the form C<T_1, ..., T_n> with

Name: object
Definition: class instance
Page: 53
Section: 3
Definition2: array
Conjdef: Either

Name: A reference value
Definition: null reference
Page: 53
Section: 3.1
Definition2: Pointer to an object
Conjdef: Either
Name2: A reference

Name: A class instance
Definition: Object explicitly created by a class instance creation expression
Page: 53
Section: 3.1

Name: An array
Definition: Object created by an array creation expression
Page: 53
Section: 3.1

Name: Object
Definition: clone
Page: 6
Section: 3.2
Definition2: equals
Definition3: finalize
Intuition: superclass of all other class.
Definition4: getClass
Typ: class
Definition5: hashCode
Definition6: wait notify notifyAll
Definition7: toString

Instruction: o.clone()
Page: 56
Language: java
Chapter: 4
Section: 3.2
Returns: A duplicate of o
Variables: o an object

Instruction: o.equals(p)
Page: 56
Language: java
Chapter: 4
Section: 3.2
Returns: whether o is equal to p, according to value and not reference
Variables: o an object

Instruction: o.finalize()
Page: 56
Effect: method called before destruction of o
Language: java
Chapter: 4
Section: 3.2
Variables: o an object

Instruction: o.getClass()
Page: 56
Effect: the class of o
Language: java
Chapter: 4
Section: 3.2
Variables: o an object

Instruction: o.hashCode()
Page: 56
Language: java
Chapter: 4
Section: 3.2
Returns: a hash code for hashtables
Variables: o an object
Typ: Int

Instruction: o.toString()
Page: 56
Language: java
Chapter: 4
Section: 3.2
Returns: a string representation of o
Variables: o an object

Instruction: x+y
Page: 56
Language: java
Context: String
Chapter: 4
Section: 3.3
Returns: the concateration of x and y
Variables: x,y strings

Question: Rule for equality of compile-time type
Answer: declared in compilation units associated with the same module
Page: 57
Chapter: 4
Section: 3.4
Context: Java type
Answer2: have the same binary name
Answer3: their type arguments, if any, are the same, applying this
definition recursively

Question: Rule for equality of run-time type
Answer: both class or both interface types
Page: 57
Chapter: 4
Section: 3.4
Answer2: defined by the same class loader
Answer3: have the same binary name
Answer4: or both array types and their component types are the same run-time type

Name: AdditionalBound
Definition: & InterfaceType
Page: 58
Section: 3.4
Context: java Type

Name: TypeBound
Definition: extends TypeVariable
Page: 58
Section: 3.4
Context: java Type
Definition2: extends ClassOrInterfaceType {AdditionalBound}
Conjdef: Either

Name: TypeParameterModifier
Definition: Annotation
Page: 58
Section: 3.4
Context: Type
Conjdef: Either

Name: TypeParameter
Definition: {TypeParameterModifier} TypeIdentifier [TypeBound]
Page: 58
Context: Type
Conjdef: Either

Name: Type variable
Definition: unqualified identifier used as a type in class, interface, method, and constructor bodies
Page: 58
Context: Type

Name: Bound of t
Definition: by default Object
Page: 58
Variables: t a type variable
Context: Java Type
Definition2: single type T
Definition3: a class or interface type T possibly followed by interface types I 1 & ... & I n .

Question: Constraint on type variable
Answer: erasures (§4.6) of all constituent types of a bound must be pairwise different, or a compile-time error occurs
Page: 58
Chapter: 4
Variables: t a type variable
Context: Java
Answer2: A type variable must not at the same time be a subtype of two interface types which are different parameterizations of the same generic interface, or a compile-time error occurs
Answer3: The order of types in a bound is only significant in that the erasure of a type variable is determined by the first type in its bound, and that a class type or type variable may only appear in the first position.
Answer4: The members of a type variable X with bound T & I 1 & ... & I n are the members of the intersection type (§4.9) T & I 1 & ... & I n appearing at the point where the type variable is declared.

Name: A well-formed parameterized type
Definition: C is the name of a generic type
Page: 58
Variables: t a type variable
Context: Java: Type
Definition2: n is the number of arguments of type parameters in the declaration of C
Conjdef: C<T_1,...,T_n>
Definition3: When subjected to capture conversion resulting in the type C<X _1 ,..., X _n > ,
each type argument X i is a subtype of S[F_ 1 :=X_ 1 ,...,F _n :=X _n ] for each bound
type S in B _i .

Name: Provably distinct parameterized type
Definition: they are parameterization of distinct generitc type declaration
Page: 60
Section: 5
Context: Type
Definition2: any of their type arguments are provably distinct
Conjdef: either

Name: WildcardBounds:
Definition: extends ReferenceType
Page: 60
Section: 5.1
Context: Type
Definition2: super ReferenceType
Conjdef: either

Name: Wildcard
Definition: {Annotation} ? [WildcardBounds]
Page: 60
Section: 5.1
Context: Type

Name: TypeArgument
Definition: ReferenceType
Page: 60
Section: 5.1
Context: Type
Definition2: Wildcard
Conjdef: Either

Name: TypeArgumentList
Definition: TypeArgument { , TypeArgument}
Page: 60
Section: 5.1
Context: Type

Name: TypeArguments
Definition: < TypeArgumentList >
Page: 60
Section: 5.1
Context: Type

Name: Provably distinct type arguments
Definition: Neither argument is a type variable or wildcard, and the two arguments are not
the same type.
Page: 61
Section: 5.1
Context: Type in Java
Definition2: One type argument is a type variable or wildcard, with an upper bound (from capture conversion (§5.1.10), if necessary) of S ; and the other type argument T is not a type variable or wildcard; and neither | S | <: | T | nor | T | <: | S | (§4.8, §4.10).
Conjdef: Either
Definition3: Each type argument is a type variable or wildcard, with upper bounds (from
capture conversion, if necessary) of S and T ; and neither | S | <: | T | nor | T | <: | S |.

Name: contains
Definition: ("? extends T" , "? extends S") if T<:S
Page: 61
Section: 5.1
Variables: S,T type arguments
<: denotes subtyping
Context: java, type's arguments
Notation: <=
Definition2: ("? extends T", "?")
Conjdef: The order relation containing
Definition3: ("? super T" , "? super S") if S<:T
Intuition: The set of types denoted by T is provably a subset of the set of types denoted by S
Definition4: ("? super T", "?")
Definition5: ("? super T", "? extends Object")
Definition6: ("T", "? super T")
Definition7: ("T", "? extends T")
Definition8: ("T", "T")

Instruction: ? extends B
Page: 61
Effect: State that there is an upper bound B
Language: java
Context: Type
Chapter: 4
Section: 5.1
Variables: S,T type arguments

Instruction: ? super B
Page: 61
Effect: State that there is a lower bound B
Language: java
Context: Type
Chapter: 4
Section: 5.1