Constructors
We need them to initialise instances.
class Star {
int edges;
public Star(int _edges) {
edges=_edges;
}
}
public class TestStar {
public static void main(String[] argv) {
Star first_star,second_star;
first_star = new Star(5) ;
second_star = new Star(7);
}
}
Previous slide
Next slide
Back to first slide
View graphic version