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 multiple methods.- What is the output of the following program? Be precise about where there are spaces and where there are newlines.
2. Draw a stack diagram that shows the state of the program the first time ping is invoked.
public
static void zoop() {
baffle();
System.out.print("You wugga ");
baffle();
}
public static void main(String[] args) {
}
public static void main(String[] args) {
System.out.print("No, I ");
zoop();
System.out.print("I ");
baffle();
}
public static void baffle() {
public static void baffle() {
System.out.print("wug");
ping();
}
public static void ping() {
public static void ping() {
System.out.println(".");
}
SOLUTION
1.
No, I wug.
You wugga wug.
I wug.
Where's the stack diagram???
ReplyDeleteHow to add commas to strings
ReplyDelete