Question: 1. What is the output produced from the following program? You may wish to draw a structure diagram first. This is a slightly modified version
1.
What is the output produced from the following program? You may wish to draw a structure diagram first. This is a slightly modified version of the previous problem, Strange.
public class Strange { public static void main(String[] args) { first();
third();
second();
third();
}
public static void first() { System.out.println("Inside first method."); }
public static void second() { System.out.println("Inside second method."); first();
}
public static void third() { first();
second();
System.out.println("Inside third method."); }
}
2.
What is the output from the following Java program?
public class Confusing { public static void method1() { System.out.println("I am method 1."); }
public static void method2() { method1();
System.out.println("I am method 2."); }
public static void method3() { method2();
System.out.println("I am method 3."); method1();
}
public static void main(String[] args) { method1();
method3();
method2();
method3();
}
}
3.
Write a complete Java program in a class named Spikey that prints the following output:
\/ \\// \\\/// ///\\\ //\\ /\
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
