- 1.only values are passed between Java language parameters, including calls by value and by reference. A method can modify the value of the variable that corresponds to the passed reference, and cannot modify the value of the variable that corresponds to the pass-through value invocation. Call by value: including the eight basic data types are called by value. When you pass a value, that means that the method gets one of all parameter valuescopy. Invoke by reference: Array, object. When passing a value, a copy of the referenced address is passed, but all points to the same object. 2.string is immutable class (final and immutable)Let us give you an example:
public class example{string Str=new string ("good"); Char[]ch={' A ', ' B ', ' C '}; public static void Main (String args[]) {Example ex=new Example (); Ex.change (ex.str,ex.ch); System.out.print (ex.str+ "and"); System.out.print (ex.ch); } public void Change (String Str,char ch[]) {//reference type variable, passed by address, belongs to reference pass. str= "Test OK"; Ch[0]= ' G '; }}
Therefore, the question should be selected B
Analysis of method value in Java by small knowledge