Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 18bcc5b

Browse files
Update 2023年12月11日-print-array-in-java.md
1 parent e26a1e5 commit 18bcc5b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

‎_posts/array/2023-12-11-print-array-in-java.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class PrintArray {
4343
**Output**
4444

4545
```
46-
Elements of the array are as give below:
46+
Elements of the array are given below:
4747
1
4848
5
4949
6
@@ -61,7 +61,7 @@ Elements of the array are as give below:
6161

6262
We have a ready-made method to print an array in Java.
6363

64-
`Arrays.toString()` method expects an array to be printed as an input parameter and returns a string of array elements.
64+
The `Arrays.toString()` method expects an array to be printed as an input parameter and returns a string of array elements.
6565

6666
Input param - array to be print
6767

@@ -132,23 +132,23 @@ Elements of the multi-dimensional array are given below:
132132

133133
## 4. Print an array using Java 8 Streams
134134

135-
In Java 8 Streams, we can use the `foreach()` method to print each element of an array.
135+
In Java 8 Streams, we can use the `forEach()` method to print each element of an array.
136136

137137
**Java Program**
138138

139139
```java
140140
import java.util.Arrays;
141141

142142
/**
143-
* Java program to print an array using Java 8 Streams foreach method
143+
* Java program to print an array using Java 8 Streams forEach() method
144144
* By coderolls.com
145145
*/
146146
public class PrintArray4 {
147147

148148
public static void main(String[] args) {
149149
int[] arr = {1, 5, 8, 7, 2, 6, 9, 6};
150150

151-
System.out.println("Elements of the array are as given below: ");
151+
System.out.println("Elements of the array are given below: ");
152152
Arrays.stream(arr).forEach(System.out::println);
153153
}
154154
}
@@ -157,7 +157,7 @@ public class PrintArray4 {
157157
**Output**
158158

159159
```
160-
Elements of the array are as given below:
160+
Elements of the array are given below:
161161
1
162162
5
163163
8
@@ -167,4 +167,3 @@ Elements of the array are as given below:
167167
9
168168
6
169169
```
170-

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /