I want to know why when integer is passed to the function it does change the value whereas when passing a vector to the function changes the value in the class Funct1.Program one prints Vector's first element as "a". While program two prints integer values i as 0.
That means that if you pass an int, the int inside the method is a new variable, with the value of the int that you passed in - it's not the same, original int. So if you change the value, you're not changing the value of the original int.
If you pass a vector, you're passing the reference to the Vector object to the method. So you pass a reference by value. The variable in the method points to the same Vector object as the original variable, so you can change the Vector object that the reference points to.
Perhaps you can see the difference if you try something like this:
This is analogous to your version with int because it is creates a new Vector to assign to the reference. In the same way, you are assigning a new int to the variable. In either case, this does not change the variable in the caller.
However, as explained above, when you call methods on an object, it will affect the state of the object no matter which reference (in the method or in main) that you use.