-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFor_Each_In_Array_19.java
More file actions
51 lines (29 loc) · 1.17 KB
/
Copy pathFor_Each_In_Array_19.java
File metadata and controls
51 lines (29 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package Java_practice;
public class For_Each_In_Array_19 {
public static void main(String[] args) {
System.out.println("Printing Array values in Simple Way ");
int [] marks = {23,34,56,78,98};
System.out.println(marks[0]);
System.out.println(marks[1]);
System.out.println(marks[2]);
System.out.println(marks[3]);
System.out.println(marks[4]);
System.out.println("************|Ends Here|**********");
System.out.println("Printing Array values Using For Loop ");
for(int i=0; i<marks.length;i++)
{
System.out.println(marks[i]);
}
System.out.println("************|Ends Here|**********");
System.out.println("Printing Array values In Reverse Way Using For Loop ");
for(int i=marks.length-1; i>=0;i--)
{
System.out.println(marks[i]);
}
System.out.println("************|Ends Here|**********");
System.out.println("Printing Array values Using For Each Loop ");
for(int element:marks)
System.out.println(element);
System.out.println("************|Ends Here|**********");
}
}