You have previously written a PurchOrderActivation class with the following logic:
class PurchOrderActivation
{
private static PurchOrderActivation construct()
{
return new PurchOrderActivation();
}
…
}
You need to instantiate PurchOrderActivation from a new class named
PurchOrderActivationExtended, which extends PurchOrderActivation.
What are two possible ways to instantiate the PurchOrderActivation class in the initialize method of
the PurchOrderActivationExtended class? Each correct answer presents a complete solution.
A . class PurchOrderActivationExtended extends PurchOrderActivation
{
public void initialize()
{
PurchOrderActivation purchOrderActivation =
PurchOrderActivation::construct();
}
}
B . class PurchOrderActivationExtended extends PurchOrderActivation
{
public void initialize()
{
var purchOrderActivation = new PurchOrderActivation();
}
}
C . class PurchOrderActivationExtended extends PurchOrderActivation
{
public void initialize()
{
var purchOrderActivation = PurchOrderActivation::construct();
}
}
D . class PurchOrderActivationExtended extends PurchOrderActivation
{
public void initialize()
{
PurchOrderActivation purchOrderActivation = new PurchOrderActivation
();
}
}
Answer: BD
Explanation:
The construct method is private, so you can not call it from another class.