quote:this is the start of a program I'm working on that adds a third variable to the Point class. I'm not quite sure why it is neccesary to use the super() method. Aren't you making a constructer method without it? And what about the "this" part?
import java.awt.*;
public class Point3D extends Point {
public int z;
public Point3D(int x, int y, int z) {
super(x,y);
this.z = z;
}
}
code:you wouldn't need the keyword, since 'z' is now un-ambiguous again - it can only refer to the member variable.public Point3D(int x, int y, int setZToThis) {
super(x,y);
z = setZToThis;
}