ArrayList without generics

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        ArrayList a = new ArrayList();
        a.add(1);
        a.add("j");
        a.add('j');
        System.out.println(a.get(0) instanceof Integer);
        System.out.println(a.get(1) instanceof String);
        System.out.println(a.get(2) instanceof Character);
    }
}

Output:

true
true
true


How ArrayList works internally ?

Comments

Popular posts from this blog

Binary Heap - Introduction

Divide and Conquer - Introduction

Bubble Sort