0
Explain how function name and constructor can be same??
public class Executor { Executor(){} void Executor() { System.out.println("Welcome Executor"); } public static void main (String[] args) { Executor e = new Executor(); e.Executor(); } }
2 Answers
+ 2
a cunstructor is called like this:
Executor e = new Executor(//constructor stuff)
you call them differently so that why you can name them the same