devxlogo

Returning Multiple Values From A Method

Returning Multiple Values From A Method

Suppose you have some C++ code that you’d like to convert to the Java programming language. While doing the conversion, you come across the following code:

   void getStats(int data[], int& count,  int& sum, int& mean) {    count = 0;    sum = 0;    mean =  0;    for (int i = 0; data[i] != -1; i++) {      count++;      sum += data[i];    }    if (count 

devx-admin

Share the Post: