Glossary
Integer Wrapper Class
A specific wrapper class in Java that encapsulates a primitive `int` value into an `Integer` object.
Example:
To add an int value to an ArrayList<Integer>, you'd use the Integer Wrapper Class like myList.add(new Integer(42));.
Null Values
A special state that wrapper class objects can hold, indicating the absence of a value, which is not possible for primitive types.
Example:
An Integer object can be assigned null (e.g., Integer myNum = null;), which is impossible for an int primitive, showcasing the ability to hold null values.
Object Requirement
The necessity for certain Java methods or data structures, like `ArrayLists`, to accept only objects as parameters or elements, not primitive data types.
Example:
An ArrayList can store Integer objects but not raw int primitives directly, illustrating the object requirement for collections.
Primitive data types
Fundamental data types in Java that store simple values directly, such as `int`, `double`, `boolean`, and `char`.
Example:
When you declare int score = 100;, int is a primitive data type storing the value directly in memory.
Wrapper classes
Classes in Java that encapsulate primitive data types into objects, allowing primitives to be treated as objects.
Example:
Instead of int count = 5;, you can use Integer countObject = new Integer(5); where Integer is a wrapper class.