Saturday, February 13, 2016

Exercise 4.4

QUESTION

What is the output of the following program?

public class Narf {

     public static void zoop(String fred, int bob) {
          System.out.println(fred);
          if (bob == 5 ) {
               ping ("not ");
          } else {
               System.out.println("!");
          }
     }
   
     public static void main(String[] args) {
          int bizz = 5;
          int buzz = 2;
          zoop("just for", bizz);
          clink(2*buzz);
     }

     public static void clink(int fork) {
          System.out.print(It's ");
          zoop("breakfast ", fork) ;
     }

     public static void ping(String strangStrung) {
          System.out.println("any " + strangStrung + "more ");
     }
}

SOLUTION

just for
any not more
It's breakfast
!

No comments:

Post a Comment