What happens if you keep return type for a constructor?

As we discussed in previous questions that we can overload a constructor so if we keep return type for a constructor it will be treated as a normal method.

Note: Compiler gives a warning message that method has a constructor name.

Example

public class Main
{
    String Main(){
        System.out.println("Hello World");
        return "Hello w3schools.com";
    }
	public static void main(String[] args) {
		Main object = new Main();
		 System.out.println(object.Main());
	}
}

Output

Hello World 
Hello w3schools.com

Java interview questions on constructor