- PDF for Module 8 Download From Here Array List: An array has one shortcoming: you have to know how many elements will be in the array when you create it.
Wrapper Classes
- Each primitive type has a wrapper class.
- Wrapper class is an Object form of primitive types, with having much more functionalities.
- We can convert primitive to wrapper and wrapper to primitive class using methods e.g. intValue()
- String to Wrapper class using valueOf method .
- String to primitive value using parseInt() method.
Autoboxing (Java 1.5 onwards)
- Java automatically convert the primitive data types to wrapper class, wherever it is required.
- Autoboxing and methods in an Integer ArrayLists (Check Index position or actual value is being removed ?)
Convert Array and List
- When you convert array to list, lists are backed by arrays. Hence, whatever operation you will apply on arrays will also be reflected In lists.
- You can also convert List to arrays back.
|