可以不用静态的,但属性和方法要通过类的实例化之后才可以用。
import java.io.IOException;
public class Class1
{
public double []a={1.2,2.3,3.4,4.5,5.6};    
public double []b={9.8,8.7,7.6,6.5,5.4};    
public float sqrt_sum(double[]x){    
float temp=0.0f;
for(int i=0;i<x.length;i++){
x[i]=Math.sqrt(x[i]);
}
for(int c=0;c<x.length;c++){
temp+=(float)x[c];
}
return temp;
}
public static void main (String[] args)
{
                  Class1 cls = new Class1();
System.out.println(cls.sqrt_sum(cls.a));
System.out.println(cls.sqrt_sum(cls.b));
try{
System.in.read();
}catch(IOException e){}
}
}