I am currently studying for the
Java 2 exam,....second time around, i am using the jqplus software and I find it does cover many areas in the Sun's syllabus which I never touched when I took my first exam.
Can anybody help me with these questions?
I will be grateful if your analysis/logic/reasoning behind these questions can be simplified in analogy and concise.
Question ID :970937185650
FlowControl
public class BreakTest
{
public static void main(
String[] args)
{
int i = 0, j = 5;
lab1 : for( ; ; i++)
{
for( ; ; --j) if( i >j ) break lab1;
}
System.out.println(" i ="+i+" , j = "+j);
}
}
What will it print?
********************************
i= 0, j = -1
********************************
Flow Control
class
Test {
public static void main(String[] args)
{
for (int i = 0; i < 10; i++) System.out.print(i + " "); //1<br /> for (int i = 10; i > 0; i--) System.out.print(i + " "); //2
int i = 20; //3
System.out.print(i + " "); //4
}
}
Which of the following statements are true?
***********************************************************************
class will compile and print 20
it will not compile if line 3 is removed
it will not compile if line 3 is removed and placed before line 1
it will not compile if line 4 is removed and placed befor line 3
option 2,3, and 4 are correct
************************************************************************