All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.pdx.cs410J.lang.PassByValue Maven / Gradle / Ivy

The newest version!
package edu.pdx.cs410J.lang;

/**
 * Demonstrates Java's pass by value mechanism
 */
public class PassByValue {
  private static void doubled(int i) {
    i = i * 2;
    System.out.println("Doubled: " + i);
  }

  public static void main(String[] args) {
    int i = 27;
    System.out.println("Before: " + i);
    doubled(i);
    System.out.println("After: " + i);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy