0

Why doesn't constructors in java don't have a return type? not even void? The are functions too right?

3rd Oct 2017, 10:13 AM
Supriyo Paul
Supriyo Paul - avatar
2 Respostas
0
From a point of view yes. As with many kinds of Java, they only make sense when you also know C++. When you create a C++ object on the stack, it doesn't really look like a method call. In late languages like Ruby on the other hand, it looks even more like a function than in Java. If a constructor had a return type, it would be the constructed type.
3rd Oct 2017, 1:43 PM
1of3
1of3 - avatar