Hi guys just wanted some clarification on two issues.
Nested Loops, I just want to clarify how i should read these for example:
public void nestedForLoop()
{
int i = 0;
int j = 0;
for (i = 0; i < 10; i++)
{
for (j = 0; j < 3; j++)
{
System.out.println("Inside both loops: " + i +"\t"+ j);
}
System.out.println("Inside outer loop: " + i +"\t"+ j);
}
System.out.println("Outside Loop: " + i +"\t"+ j);
}
How should i read a nested for loop? Like would this run essentially 30 times? Does it basically say run the inside loop 10 times? So then does it basically run once, go into the nested loop, run 3 times, then go back into the outer loop, then back into the nested loop 3 times?
And I'v read a few definitions and my lecturer has failed what a 'literal' is effectivley. So can i ask, what are they?
Thanks in advance, just want to clear the ideas in my head, because they're surrounded by a lot of confusion.