package com.company;
public class Main {
public static void main(String[] args) {
// write your code here
/////////////////////////////////////////////////////////////////// // Example 01
int original = 10;
System.out.println("\n\nOriginal before: " + original);
incrementValue(original);
System.out.println("Original after: " + original);
////////////////////////////////////////////////////////////////// // Example 02
int[] arrayOriginal = { 7,14,21 };
System.out.println(
"\n\n\nThe value of \"arrayOriginal[0]\" before being sent to method \"incrementValue2\" is: " +
arrayOriginal[0]);
incrementValue2(arrayOriginal);
System.out.println(
"The value of \"arrayOriginal[0]\" after being sent to method \"incrementValue2\" and exiting the method is: " +
arrayOriginal[0]);
}
static void incrementValue(int inMethod) {
inMethod++;
System.out.println("In method (section 1): " + inMethod);
System.out.println("In method (section 2): " + ++inMethod);
System.out.println("In method (section 3): " + inMethod++);
++inMethod;
System.out.println("In method (section 4): " + inMethod);
System.out.println("In method (section 5): " + inMethod++);
System.out.println("In method (section 6): " + ++inMethod);
}
static void incrementValue2(int[] inMethod2) {
inMethod2[0]++;
System.out.println("The value of \"inMethod2[0]\" is: " + inMethod2[0]);
}
}