1
1
mirror of https://github.com/namibia/awesome-cheatsheets.git synced 2024-11-21 12:25:14 +00:00

Merge pull request #219 from dreamysap/Sapna-JavaChanges

Updated java.md
This commit is contained in:
Julien Le Coupanec 2021-07-17 14:51:56 +02:00 committed by GitHub
commit a2d51368dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -196,6 +196,24 @@ int c = a + b;
System.out.println(i);
}
```
>Enhanced for loop/for-each
```java
for(dataType item : array) {
...
}
```
**Example:**
```java
// array of numbers
int[] numbers = {100, 200, 300, 400};
// for each loop
for (int number: numbers) {
System.out.println(number);
```
> WHILE LOOP STATEMENT
```java
while(condition){ //till condition will be true.