hacker rank 52nd java solution(java factory pattern)

52.java factory pattern 


//pre written code on hacker rank

switch (order){
   case "pizza" :return new Pizza();
   case "cake" : return new Cake();
   default: return null;
 }


Compiler Message
Success
Input (stdin)Download
cake
Expected OutputDownload
The factory returned class Cake
Someone ordered a Dessert!

Comments

Popular posts from this blog

Amazon Web Services

Google Code-In mentorship experience :)

Hacker Rank all java and python problem solutions