How to call constructor of a different class which is in same package . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to call constructor of a different class which is in same package .

22nd Jul 2017, 7:47 PM
Arun
Arun - avatar
4 Answers
+ 4
Just create an object of the class. It will automatically trigger the constructor if there's one.
22nd Jul 2017, 8:25 PM
Yasiru Nayanajith
Yasiru Nayanajith - avatar
+ 3
Type in the class's name: Animal dog = new Animal("Doggo");
22nd Jul 2017, 7:54 PM
Limitless
Limitless - avatar
+ 1
I do not understand your problem.
22nd Jul 2017, 7:51 PM
Jonas Schröter
Jonas Schröter - avatar
+ 1
New cladsName(parans);
22nd Jul 2017, 8:19 PM
josh mizzi
josh mizzi - avatar