Question: Part ( a ) : 3 points Precisely what does the following program output when it is executed? class Strange { static void first (

Part (a): 3 points
Precisely what does the following program output when it is executed?
class Strange
{
static void first ()
{
System.out.println ("Inside first method!");
}
static void second ()
{
System.out.println ("Inside second method!");
first ();
}
static void third ()
{
System.out.println ("Inside third method!");
first ();
second ();
}
public static void main (String [] args)
{
first ();
third ();
second ();
third ();
}
}
Part (b): 3 points
What would have been the output of the preceding program if the method
third had instead been written like this?
static void third()
{
first();
second();
System.out.println("Inside third method!");
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!