In the first code example of this guide for newcomers to Injection Dependency, I came across some new constructs that I'm not sure about that I fully understand:
Constructor constructor = cabAgencyClass.getConstructor
(new Class[]{AirlineAgency.class});
cabAgency = (CabAgency) constructor.newInstance
(new Object[]{airlineAgency});
What does it mean new Class[]{AirlineAgency.class}and does?
I understand that his goal is to create an instance Constructorfor AirlineAgency.class, but how does the syntax do this new Class[]{}?
Why is the concept of an array []when there is only one object?
What is the syntax {}here? Why not ()?
source
share