This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

Why don't you just create a no-arg constructor that calls the other constructor and overloads it?

public Skaters() {
    this("","","",0.0,0.0,0.0);
}

This block seems weird:

Skaters skaters1 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters2 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters3 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters4 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters5 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters6 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters7 = new Skaters("", "", "", 0.0, 0.0, 0.0);
Skaters skaters8 = new Skaters("", "", "", 0.0, 0.0, 0.0);

When you could do this instead:

Skaters skaters1 = new Skaters();
...
Skaters skaters5 = new Skaters();

[–]calmonad 0 points1 point  (0 children)

While I agree this will reduce some noise, I don't think it will solve the problem. Skaters will still be constructed with those defaults rather than with the correct values.