public class program1{
    public static void main(String args[]){
        java.util.Vector vc=new java.util.Vector();
        vc.add("111");
        vc.add("222");
        functioncall(vc);
        vc.add("333");
        System.out.println(vc);
    }
    public static void functioncall(java.util.Vector vc){     
        vc=null;    
    }
}
The output of above program is [111,222,333]. but, when I run the following program the output is [333]. Confused when we pass an reference , how it works whether it is call by value or call by reference? and why
public class program1{
    public static void main(String args[]){
        java.util.Vector vc=new java.util.Vector();
        vc.add("111");
        vc.add("222");
        functioncall(vc);
        vc.add("333");
        System.out.println(vc);
    }
    public static void functioncall(java.util.Vector vc){
        vc.removeAllElements();  
    }
}
 
     
     
     
     
     
     
     
     
     
     
    