I have created two Function objects, the values in the first get overwritten with the values assigned to the second object.
What is wrong in this approch?
public class Function {
private static double coefficient;
private static int startX;
private static int endX;
private static int exponent;
protected Function(double coefficient, int startX, int endX, int exponent) {
this.coefficient = coefficient;
this.startX = startX;
this.endX = endX;
this.exponent = exponent;
}
public static void main(String[] args) {
Function func1 = new Function(2, 1, 2, 2);
Function func2 = new Function(0,1,2,1/3);
// now func1 properties are the same as func2
}
}
}
Anonymous User
27-Dec-2015