#How does Class::new work?
9 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @split robin! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
in particular, say i had something like this:
class Foo {
private final int x;
private final int y;
public Foo(int x, int y) {
this.x = x;
this.y = y;
}
public Foo(int x) {
this(x, 0);
}
}
what would Foo::new do?
which constructor does it use? is there a way to specify?
Well, I am pretty sure you can't use it outside of the stream api, because you would need 2 values to be able to pass it in. And like I explained n the bot commands channel
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.