在Java中,’静态方法’看起来像这样:
class MyUtils { . . . public static double mean(int[] p) { int sum = 0; // sum of all the elements for (int i=0; i<p.length; i++) { sum += p[i]; } return ((double)sum) / p.length; } . . . } // Called from outside the MyUtils class. double meanAttendance = MyUtils.mean(attendance);
编写“静态方法”的等效“Ruby方式”是什么?