Array vs Arraylist java

Array vs ArrayList java: Array: 1. Size must be defined during initialization itself. 2. Size can not be resized once initialized. int[] myArraySize = new int[10]; //Possible int[] myArray = new int[];  // Not possible 3. Size of the array calculated using length. int[] myArr = new int[9];System.out.println("size of the array : "+myArr.length); //prints 9 4. Both objects and primitives

95 total views, no views today

» Read more

Autoboxing and Unboxing in java

Autoboxing and Unboxing in java: Autoboxing:¬†Converting primitive data type to wrapper class objects. Eg: int to Integer, double to Double, float to Float etc.., Unboxing:¬†Converting wrapper class objects to primitive data types. Eg: Integer to int, Double to double, Float to float etc..,   Autoboxing Example program: import java.util.Vector; public class Autoboxing { public static void main(String[] args) { //

81 total views, no views today

» Read more