Java – Guida alla programmazione - James Cohoon, Jack Davidson Copyright © The McGraw-Hill Companies srl Dimostrazione del passaggio di parametri per valore public class Demo public static double add(double x, double y) double result = x + y; return result; } public static double multiply(double x, double y) x = x * y; return x; } public static void main(String[] args) double a = 8, b = 11; double sum = add(a, b); System.out.println(a b + = + sum); double product = multiply(a, b); System.out.println(a + * + b + = + product); }
{}