-
Notifications
You must be signed in to change notification settings - Fork 0
/
C04Arrays.java
50 lines (41 loc) · 1.34 KB
/
C04Arrays.java
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
package day14;
import java.util.Arrays;
public class C04Arrays {
public static void main(String[] args) {
// String myArray[]=new String[4];
// myArray[0]="Ali";
// myArray[1]="Veli";
// myArray[2]="Pýnar";
// myArray[3]="Fatma";
// String myArray[]={"Ali","Veli","Pinar","Fatma"};
// System.out.println(Arrays.toString(myArray));
// System.out.println(myArray[0]);
// myArray[0]="Can";
// myArray[2]="Gul";
// System.out.println(Arrays.toString(myArray));
// System.out.println(myArray.length);
// int says=myArray.length;
//
// int myArray[]={9,10,11};
//
// for (int i=0;i< myArray.length;i++){
// System.out.println(myArray[i]);
// }
// System.out.println(Arrays.toString(myArray));
//
// int myArray[] = {1, 2, 3};
// int temp = myArray[0];
// for (int i = 0; i < myArray.length; i++) {
// if ( i < myArray.length - 1){
// myArray[i] = myArray[i + 1];
// }else myArray[i] = temp;
// }
// System.out.println(Arrays.toString(myArray));
int myArray[] = {1, 2, 3, 4, 5, 6};
int toplam = 0;
for (int i = 0; i < myArray.length; i++) {
toplam += myArray[i];
}
System.out.println("Toplam :" +toplam);
}
}