Code:
System.out.println("begin...");
for(int i =0; i <=2; i++)
{
System.out.println("cat");
System.out.println("nip");
System.out.println();
}
System.out.println("end...");
output
Code:
begin...
cat
nip
cat
nip
cat
nip
end...
if you are in a class, and having an exam, then that means you should have been trying code, practicing, etc- all that aside- it means you should have an IDE (eclipse, netbeans, etc)
in short- you could have (and still can for extra practice/combinations) coded this real quick and seen the answer
you need to expose yourself to as many code situations as possible.
edit:
the code block for output puts in some extra line breaks after "end..." it would not do extras, just one