Question: The point of this exercise is to practice reading code and to make sure that you understand the flow of execution through a program with

The point of this exercise is to practice reading code and to make sure that you understand the flow of execution through a program with multiple methods.


a. What is the output of the following program? Be precise about where there are spaces and where there are newlines.


Hint: Start by describing in words what ping and baffle do when they are invoked.


b. What happens if you invoke baffle(); at the end of the ping method?


public static void zoop() {
baffle();
System.out.print("You wugga");
baffle();
}
public static void main(String[] args)
{
System.out.print("No, I ");
zoop();
System.out.print("I ");
baffle();
}
public static void baffle() {
System.out.print("wug");
ping();
}
public static void ping() {
System.out.println(".");
}



2. The point of this exercise is to make sure you understand how to write and invoke methods that take parameters.



a. Write the first line of a method named zool that takes three parameters: 


an int and two Strings.



b. Write line of code that calls zool, passing as arguments the value 11,the name of your first pet (make one up if needed), and the name of a street you grew up on.

Step by Step Solution

3.46 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public class sample public static void zoop baffle Systemoutprintyou wugga baffle public static v... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!