// exj6.java example file create function or procedure and call import java.io.*; // needed for input and output public class exj6 // class name same as file name { // declarations for entire class may go here public exj6() // constructor same as class name { // declarations for this procedure go here // typically first, yet may be in code, just before use int i, j; int jj[] = new int[1]; // single value made into an array to get return double arr[][]={{1.0,2.0,3.0},{4.0,5.0,6.0}}; double val; System.out.println("exj6.java running"); // call proc1, all functions and procedures after constructor proc1(7); // use funct1 i = funct1(2, 3); System.out.println("funct1(2,3) returns "+i); val = sum(arr); // size of array found in sum System.out.println("sum(arr)= "+val); i = ret2(i, jj); // pass jj by address so it can be changed System.out.println("ret2 i="+i+", jj="+jj[0]); System.out.println("end exj6.java"); } // end constructor exj6 double sum(double A[][]) // determine size inside { double asum = 0.0; int n = A.length; int m = A[0].length; for(int i=0; i