//////////////////
// START
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]);
//////////////////////////////////////////////////////////////////
// Example 03:
String originalString = "originalString !!!";
System.out.println(
"\n\n\nThe value of \"originalString\" before being sent to method \"changeString\" is: " +
originalString);
changeString(originalString);
System.out.println(
"The value of \"originalString\" after being sent to method \"changeString\" and exiting the method is: " +
originalString);
//////////////////////////////////////////////////////////////////
// Example 04:
int originalInteger = 100;
System.out.println(
"\n\n\nThe value of \"originalInteger\" before being sent to method \"incrementValue4\" is: " +
originalInteger);
incrementValue4(originalInteger);
System.out.println(
"The value of \"originalInteger\" after being sent to method \"incrementValue4\" and exiting the method is: " +
originalInteger);
//////////////////////////////////////////////////////////////////
}
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]);
}
static void changeString(String inMethod3) {
inMethod3 = "New string!";
System.out.println("The value of \"inMethod3\" is: " + inMethod3);
}
static void incrementValue4(int inMethod4) {
inMethod4 *= 25.758595;
System.out.println("The value of \"inMethod4\" is: " + inMethod4);
}
}
// THE END
///////////////////////