Hello everybody,
This is my first time on this forum. I started this year with a study, where i learn Java. I'm from the Netherlands, so some names in the classes you may not know.
I have a problem with printing out a few arrays of P in the class Veelhoek.
I think i have made some mistakes in the print constructor.
All help is appreciated! :)
Kind Regards
MeandJava
class Veelhoek {
Punt[]P;
public Veelhoek() {
P = new Punt[3];
P[0] = new Punt (0,0);
P[1] = new Punt (0,0);
P[2] = new Punt (0,0);
}
public Veelhoek (int d) {
P = new Punt [d];
for(int i = 0; i<d; i++){
P[i] = new Punt (0,0);
}
}
void print() {
for(int i = 0; i<P.length; i++){
System.out.println(P[i]);
}
}
}
public static void main(String[] args) {
Veelhoek V;
V = new Veelhoek();
V.print();
System.out.println();
}
}