View Single Post
Old 05-19-2012, 02:53 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
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
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote