mirror of
https://github.com/namibia/awesome-cheatsheets.git
synced 2024-11-25 06:07:34 +00:00
Merge pull request #219 from dreamysap/Sapna-JavaChanges
Updated java.md
This commit is contained in:
commit
a2d51368dc
@ -196,6 +196,24 @@ int c = a + b;
|
|||||||
System.out.println(i);
|
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
|
> WHILE LOOP STATEMENT
|
||||||
```java
|
```java
|
||||||
while(condition){ //till condition will be true.
|
while(condition){ //till condition will be true.
|
||||||
|
Loading…
Reference in New Issue
Block a user