logo

Crowdly

Mis omadused on iseloomulikud Factory disainimustrile? import java.util.List; ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Mis omadused on iseloomulikud Factory disainimustrile?

import java.util.List;

import java.util.ArrayList;

class Pet {

private static List<Pet> pets = new ArrayList<Pet>();

/*

Some other stuff...

*/

private Pet() {}

public static Pet getPet() {

if (pets.size() == 10) {

return null;

}

Pet p = new Pet();

pets.add(p);

return p;

}

}

0%
More questions like this

Want instant access to all verified answers on moodle.taltech.ee?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!