For Each Loop(Enhanced for loop)
This loop is introduced in java 1.5 version and it designed for accessing the elements from arrays (collection). It is also called as enhanced for loop. Syntax: for(declaration:arrayname){ statements; }…
This loop is introduced in java 1.5 version and it designed for accessing the elements from arrays (collection). It is also called as enhanced for loop. Syntax: for(declaration:arrayname){ statements; }…
An array is a derived data type, which can be used for storing multiple values. If an application requires multiple values, then we can store those multiple values by declaring…
Break: Break is a transfer statement which can be used either inside switch statement or inside a loop. Note: When we are specifying the break statement in a loop we…
If we specify a loop inside another loop then it is called as nested loop. Any loop can be specified inside any other loop any number of times. Program: Program
This loop can be used for executing the statements multiple times. A do-while loop has to be used when we do not know the exact number of iterations. Syntax: Program…
This loop can be used for executing the statements multiple times. A while loop has to be used when we do not know the exact number of iterations. Syntax: Program:…
For Loop This loop can be used for executing the statements multiple times. A for loop has to be used when we know the exact number of interations. Syntax Program…
The switch statement can be used for executing a group of statements based on a value. Syntax Program5: Rule1: Specifying the arguments to switch statement is mandatory and it should…
If-else Statement: If else statement can be used for executing a group of statements based on condition. Syntax If the condition is satiesfied then it will be executing if block…
The statement of a java program will be executed in sequential order. If we don’t want to execute the statements in sequential order i.e. if we want to execute the…