java - run from a separate class -


so need run class second class. how do that? here's code want run separate class:

import java.util.*;  public class numbers {      int min(int a, int b, int c, int d, int e) {         int min1 = math.min(a, b);         int min2 = math.min(c, d);         int min3 = math.min(min1, min2);         int min4 = math.min(min3, e);          return min4;     }     int max(int a, int b, int c, int d, int e) {         int max1 = math.max(a, b);         int max2 = math.max(c, d);         int max3 = math.max(max1, max2);         int max4 = math.max(max3, e);          return max4;     }     double avg(int a, int b, int c, int d, int e) {         double average = (a+b+c+d+e)/5;          return average;     }     double stddev(int a, int b, int c, int d, int e) {         double average = (a+b+c+d+e)/5;         double a1 = math.pow((a-average),2);         double b1 = math.pow((b-average),2);         double c1 = math.pow((c-average),2);         double d1 = math.pow((d-average),2);         double e1 = math.pow((e-average),2);         double average2 = (a1+b1+c1+d1+e1)/5;         double x;         x = math.sqrt(average2);         return x;      }  } 

somewhere in class, instantiate class , call appropriate methods:

numbers instance = new numbers(); int maxvalue = instance.max(1, 2, 3, 4, 5); 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -