No. Java constructors cannot return values. If needed, just create a method that calls the required constructor and returns the required value. See example below.
public class Tester { public Tester(){} public static Tester getInstance(){ Tester tester = new Tester(); return tester; } }
The above is the detailed content of Java constructors return a value, but what do they return?. For more information, please follow other related articles on the PHP Chinese website!