Question: You have a class called Statistics that has a ( public ) method called average that takes an array of doubles and returns the average

You have a class called Statistics that has a (public) method called "average" that takes an array of doubles and returns the average of the array.
Suppose you see the following line(s) of code in another file:
double[] arr ={4.0,2.3,4.6,1.1};
double avg = Statistics.average(arr);
System.out.println("the average is: "+ avg);
What listed below must be true about the average method?
Group of answer choices
average must be a private method
average must be a static method (no instance of the Statistics class)
average is being called on an instance of the Statistics class
the code won't compile

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!