You are viewing a single comment's thread. Return to all comments →
//Complete the classes below class Flower { String whatsYourName(){ return "I have many name and types."; } }
class Jasmine extends Flower { String whatsYourName(){ return "Jasmine"; }
}
class Lily extends Flower { String whatsYourName(){ return "Lily"; }
class Region { Flower yourNationalFlower(){ return new Flower(); } }
class WestBengal extends Region { Jasmine yourNationalFlower(){ return new Jasmine(); } }
class AndhraPradesh extends Region { Lily yourNationalFlower(){ return new Lily(); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Covariant Return Types
You are viewing a single comment's thread. Return to all comments →
//Complete the classes below class Flower { String whatsYourName(){ return "I have many name and types."; } }
class Jasmine extends Flower { String whatsYourName(){ return "Jasmine"; }
}
class Lily extends Flower { String whatsYourName(){ return "Lily"; }
}
class Region { Flower yourNationalFlower(){ return new Flower(); } }
class WestBengal extends Region { Jasmine yourNationalFlower(){ return new Jasmine(); } }
class AndhraPradesh extends Region { Lily yourNationalFlower(){ return new Lily(); } }