What happens if you run this code:

class Test {
    List<Integer> list;
    Test(){
        list = new ArrayList<Integer>();
        someVoid(list);
    }
    void someVoid(List<Integer> l){
        l.add(0);
        l=null;
    }
    public static void main(String[] args) {
        Test test=new Test();
        System.out.println("Size is: "+test.list.size());
    }
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes