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(); } }

6th Jun 2019, 11:02 AM
Heisenberg
Heisenberg - avatar
2 Antworten
+ 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
6th Jun 2019, 11:06 AM
Cat Sauce
Cat Sauce - avatar