I' m using NETBeans 6
do you mean about java? I'm reading one and I' m trying to understand here the things I' m not sure of . Another one question , i wrote this class:
class Piano{
static public double calc(double x1, double y1, double x2, double y2 ){
double z = (x1 -x2)*(x1-x2) + (y1-y2)*(y1-y2);
System.out.println(Math.sqrt(z));
return z;
}}
to calculate distance between two point of cartesian plane, but if I delete the "return z" string , NETBean say that I missed to insert the returned type.
But I 've already declared the type(double) of z , I know return is used to get the result of the operation and return it to the program, but I don' t understand why is necessary here since I' ve only asked to print a line , not to use the result for something else .