Name of the class has to be main only if the class is


/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static double average(double [] x)
{
double sum=0;
for( int i=0 ;i {
sum+=x[i];
}
return (sum/x.length);
}

public static void main (String[] args) throws java.lang.Exception
{
double[] mylist = {1.9, 2.9, 3.4, 3.5};
System.out.println(average(myList));
}
}
number 1 and 2 are not working please help 3,4,5 work

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Name of the class has to be main only if the class is
Reference No:- TGS02384651

Now Priced at $10 (50% Discount)

Recommended (99%)

Rated (4.3/5)