What is the String?

We have seen an array of integers.similarly we can also have array of float numbers. But when we make an array of character i.r “char” type data, it is termed as a string. A string i.e an array of character is normally terminated with a null character to indicate the termination.

String
String

Call by value method:

*, In this case, the value of the parameter is passed to the called function
*, In this case, the actual parameters are not accessible by the called function
*Hence the actual parameter remains unchanged in case of the call by value.

public class ExampleMinNumber {
   
   public static void main(String[] args) {
      int a = 11;
      int b = 6;
      int c = minFunction(a, b);
      System.out.println("Minimum Value = " + c);
   }

   /** returns the minimum of two numbers */
   public static int minFunction(int n1, int n2) {
      int min;
      if (n1 > n2)
         min = n2;
      else
         min = n1;

      return min; 
   }
}

This will produce the following result −

Output
Minimum value = 6

Translate »