how can I resolve an error ... @ 15db9742

0

I'm practicing and I get an error

  

interpolacion.interpolacion@15db9742

package interpolacion;

public class interpolacion {

    public static void  Interpo(double X, float[] rango_X, float[] rango_Y ){
        int Leng , xp1;
        float dif  ,difn , pro;
        double X0, X1 ;
        double y0 , y1 ;
        double interpol;   

        Leng = rango_X.length - 1;
        if (Leng >= 1){ 
            dif = rango_X[0] - rango_X[1];
            if (dif == 0){  
                System.out.println("varios valores iguales");
                return ;

            }
            for ( int K = 2;K< Leng-1;K++){
                if (Leng == 1){
                    break;
                }   

                difn = rango_X[K - 1] - rango_X[K];
                pro = dif * difn;
                if (pro <= 0){
                     System.out.println("");
                    return ;
                }
            }
            xp1 = 0;
            for(float C : rango_X){
                if (dif < 0){
                    if (C > X)
                        break;{
                    }
                }else{
                    if (C < X){
                        break;
                    }

                xp1 = xp1 + 1;
                }
            }
            if (xp1 > Leng){
                xp1 = Leng;
            }
            if (xp1 < 1){
                xp1 = 1;
            }
            X0 = rango_X[xp1 - 1];
            X1 = rango_X[xp1];
            y0 = rango_Y[xp1 - 1];
            y1 = rango_Y[xp1];
            interpol=y0 + (X - X0) * (y1 - y0) / (X1 - X0);
           System.out.println(interpol);
        }
        return ;
    
asked by user50855 10.07.2017 в 04:52
source

1 answer

4

It is not an error, that trace corresponds to the line System.out.println(interpol); that you have at the end.

Your line is equivalent to System.out.println(interpol.toString()); , and the default% toString() method shows the memory position of the object on which it is invoked. If you want to show more relevant information you have to overwrite it in a similar way to this:

@Override
public String toString(){
    StringBuilder str = new StringBuilder();
    str.append("X0:").append(X0);
    str.append("X1:").append(X1);
    str.append("y0:").append(y0);
    str.append("y1:").append(y1);
    //etc
    return str.toString();
}
    
answered by 10.07.2017 в 09:36