w Javie, Dlaczego otrzymuję ten błąd:Java Error: Konstruktor jest niezdefiniowana
Error: The constructor WeightIn() is undefined
kod Java:
public class WeightIn{
private double weight;
private double height;
public WeightIn (double weightIn, double heightIn){
weight = weightIn;
height = heightIn;
}
public void setWeight(double weightIn){
weight = weightIn;
}
public void setHeight(double heightIn){
height = heightIn;
}
}
public class WeightInApp{
public static void main (String [] args){
WeightIn weight1 = new WeightIn(); //Error happens here.
weight1.setWeight(3.65);
weight2.setHeight(1.7);
}
}
Mam konstruktora zdefiniowany.
Kompilator ma rację. Konstruktor 'WeightIn()' jest ** nie ** zdefiniowany. –
czy możesz poprawić kod, a następnie skopiować go, aby go zrozumieć? – user2669883
Scrit nadal nie działa – user2669883