-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeste001.java
More file actions
55 lines (31 loc) · 902 Bytes
/
Copy pathTeste001.java
File metadata and controls
55 lines (31 loc) · 902 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
44
45
46
47
48
49
50
51
52
53
54
55
package Programa;
import java.util.Arrays;
public class Teste001 {
public static void main(String[] args) {
long startTime = System.nanoTime();
String minhaS = "Muito bom";
System.out.println(minhaS);
System.out.println("--------------------------");
System.out.println("tamanho do string: " + minhaS.length());
System.out.println("--------------------------");
String f1 = "laranja";
String f2 = f1;
f1 = "uva";
System.out.println("f1: " + f1);
System.out.println("f2: " + f2);
// Your code here
long endTime = System.nanoTime();
long duration = (endTime - startTime); // total time in nanoseconds
//milliseconds
System.out.println("Execution time: " + (duration / 1000000) + " ms");
}
}
/*
Muito bom
--------------------------
tamanho do string: 9
--------------------------
f1: uva
f2: laranja
Execution time: 23 ms
*/