Skip to content

Commit 2854974

Browse files
Add files via upload
1 parent 87b3483 commit 2854974

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed
141 Bytes
Binary file not shown.

arrays in java/bin/p1/C1.class

1.29 KB
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
*
3+
*/
4+
/**
5+
*
6+
*/
7+
module p1 {
8+
}

arrays in java/src/p1/C1.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package p1;
2+
3+
import java.util.Arrays;
4+
5+
public class C1 {
6+
7+
public static void main(String[] args) {
8+
// TODO Auto-generated method stub
9+
// System.out.println("hello world");
10+
11+
// arrays
12+
13+
int[] listof_arrays = {1,2,3,4,5,6,7,8,8,9};
14+
System.out.println(Arrays.toString(listof_arrays));
15+
16+
int i = 0;
17+
while (i < 1) {
18+
System.out.println(listof_arrays[i]);
19+
i++;
20+
21+
}
22+
23+
// for loops
24+
for (int index = 0; index < 5; index++) {
25+
System.out.println(listof_arrays[index]);
26+
}
27+
28+
for (int elements : listof_arrays) {
29+
System.out.println(elements);
30+
}
31+
32+
// to calculate length
33+
String str = "hello WORLD";
34+
int forlen = str.length();
35+
System.out.println(forlen);
36+
37+
// to lowercase
38+
String lowercase = str.toLowerCase();
39+
System.out.println(lowercase);
40+
41+
// to replace
42+
String rplace = str.replace('h', 's');
43+
System.out.println(rplace);
44+
45+
String uppercase = str.toUpperCase();
46+
System.out.println(uppercase);
47+
48+
49+
50+
}
51+
52+
}

0 commit comments

Comments
 (0)