-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrays.java
More file actions
43 lines (25 loc) · 859 Bytes
/
Arrays.java
File metadata and controls
43 lines (25 loc) · 859 Bytes
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
package com.laiane.cursojava.aula19;
public class Arrays {
public static void main(String[] args) {
double tempDia001 = 31.3;
double tempDia002 = 32;
double tempDia003 = 33.7;
double tempDia004 = 34;
double tempDia005 = 33.1;
double[] temperaturas = new double[365];
temperaturas[0] = 31.3;
temperaturas[1] = 32;
temperaturas[2] = 33.7;
temperaturas[3] = 34;
temperaturas[4] = 33.1;
System.out.println("O valor da temperatura do dia 3 é: " + temperaturas[2]);
System.out.println("O tamanho do array: " + temperaturas.length);
System.out.println("Valores do array: ");
for (int i=0; i<temperaturas.length; i++){
System.out.println("O valor da temperatura do dia " + (i+1) + " é: " + temperaturas[1]);
}
for (double temp : temperaturas){
System.out.println(temp);
}
}
}