BuiltWithNOF
Read Code

What is the output for the following code? Put your FINAL answer in the box provided.  BE CAREFUL!

 

public class TestPrep

{

public static void main( String args[] ) throws IOException

{

int a,b,c,wait;

a=4; b=7; c=9;

while (a < c)

{

System.out.println(a + " loop");

if ( a < b)

System.out.println("stop");

if ( a + b > c)

{

while ( a < b )

{

if ( a == 5)

System.out.println("stuff" + b);

b--;

if (b == a)

{

System.out.println("YES!");

a++;

}

System.out.println("again" + a);

}

a++;

}

a+=2;

System.out.println("stop");

}

if ( b < 7)

{

b++;

System.out.println(a);

}

System.out.println("more");

}

}

What is the output for the following code? Put your FINAL answer in the box provided.  BE CAREFUL!

 

public class TestPrep

{

public static void main( String args[] ) throws IOException

{

int a,b,c,wait;

a=2; b=6; c=9;

while (a < c)

{

System.out.println(a + " loop");

if ( a < b)

System.out.println("stop");

if ( a + b > c)

{

while ( a < b )

{

if ( a == 5)

System.out.println("stuff" + b);

b--;

if (b == a)

{

System.out.println("YES!");

a++;

}

System.out.println("again" + a);

}

a++;

}

a+=2;

System.out.println("stop");

}

if ( b < 7)

{

b++;

System.out.println(a);

}

System.out.println("more");

}

}

 

[Java at Evergreen] [Syllabus] [To Do List] [Lessons/Programs] [Evaluation/Review] [Help] [FAQ/GWIFO] [Discuss/Reports] [Resources] [Readings] [Portfolio] [Instructor]