When I Run This Code It Return That "Exit Status 143" in Java

When I run this code it return that "exit status 143" in java, I don't know what's going wrong there, hope someone can help me fix this problem.

class Main {
    static double diff(double y, double x, double d){
     if((y*y*y)+d>x)
     return ((y*y*y)+d-x);
     else return(x-(y*y*y)+d);
    }

    static double cubicRoot(double x, double d){
      double start=0 , end=x;
      double e = 0.01;
      while(true){
        double y=(start+end)/2;
        double error = diff(x,y,d);
        if (error <= e)
        return y;
        if(y*y*y+d>x)
        end =y;
        else 
        start =y;
      }
    }

      public static void main(String[] args) {

        double x =10;
        double d =0.1;
        System.out.println("root y is:" + cubicRoot(x,d));

      }
    }
4

1 Answer

Exit code 143 corresponds to SIGTERM, which is the signal sent by default when you run kill .

Did you or the OS kill the process? Is it an infinite loop that you eventually killed?

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest