I was doing simple java programming.But I couldn't find why my code doesn't show exect output.It should print the sqrt of given number but the output is 0.
import java.lang.*;
class Calculator{
double i;
double x=Math.sqrt(i);
}
public class MultipleObject {
public static void main(String[] args) {
// TODO Auto-generated method stub
Calculator a=new Calculator();
a.i = 16;
System.out.println(a.x);
}
}