Please tell me, what the issue to call super.gerDescrition() inside String.format as argument?
Is it unsafe? Can it break something? Why do we need first call super.getDescrition, then + String.format with remaining cotents?
My code perfectly meets all task requirenments, but getDescrition() or EuropeanHen verefication was failed.
package com.codegym.task.task14.task1408;
/*
Chicken factory
*/
public class Solution {
public static void main(String[] args) {
Hen hen = HenFactory.getHen(Continent.AFRICA);
hen.getMonthlyEggCount();
System.out.println(hen.getDescription());
}
static class HenFactory {
static Hen getHen(String continent) {
switch(continent){
case Continent.AFRICA: return new AfricanHen();
case Continent.ASIA: return new AsianHen();
case Continent.EUROPE: return new EuropeanHen();
case Continent.NORTHAMERICA: return new NorthAmericanHen();
default: return null;
}
}
}
}