@@ -7,10 +7,15 @@ public static void main(String[] args) {
7
7
System .out .println ();
8
8
System .out .println ("Criando cliente 1" );
9
9
Cliente cliente = new Cliente ();
10
+
11
+ cliente .setNome (" Manoel " );
12
+ cliente .setCpf ("999999999999" );
10
13
cliente .setRenda (-10000 );
11
14
cliente .setSexo ('M' );
12
15
cliente .setAnoNascimento (1990 );
16
+ cliente .setCidade ("Fortaleza" );
13
17
18
+ System .out .println ("Nome: " + cliente .getNome ());
14
19
System .out .println ("Renda: " + cliente .getRenda ());
15
20
System .out .println ("Ano de Nascimento: " + cliente .getAnoNascimento ());
16
21
System .out .println ("Sexo: " + cliente .getSexo ());
@@ -25,13 +30,43 @@ public static void main(String[] args) {
25
30
// cliente2.setRenda(10000);
26
31
// cliente2.setSexo('F');
27
32
cliente2 .setAnoNascimento (1890 );
33
+ cliente2 .setNome ("Raysa Melo" );
34
+ cliente2 .setCpf (new String ("999999999999" ));
35
+ cliente2 .setCidade ("FORTALEZA" );
36
+
37
+
38
+ // No Java, ao comparar strings, você não deve usar o operador ==,
39
+ // pois ele compara as referências de objeto em vez do conteúdo real das strings.
40
+ // Em vez disso, você deve usar o método equals() para comparar o conteúdo das strings.
41
+ // if (cliente.getCpf() == cliente2.getCpf())
42
+ // System.out.println("Os cpfs são iguais");
43
+ // else System.out.println("Os cpfs são diferentes");
44
+
45
+ if (cliente .getCpf ().equals (cliente2 .getCpf ())) {
46
+ System .out .println ("Os CPFs são iguais" );
47
+ } else {
48
+ System .out .println ("Os CPFs são diferentes" );
49
+ }
28
50
51
+ if (cliente .getCidade ().equalsIgnoreCase (cliente2 .getCidade ()))
52
+ System .out .println ("Mesma cidade" );
53
+ else System .out .println ("Cidades diferentes" );
54
+
55
+ var vetorNome = cliente2 .getNome ().split (" " );
56
+ //String[] vetorNome = cliente2.getNome().split(" ");
57
+
58
+
59
+ System .out .println ();
60
+ System .out .println ("Nome: " + cliente2 .getNome ());
61
+ System .out .println ("Primeiro Nome: " + vetorNome [0 ]);
62
+ System .out .println ("Sobrenome: " + vetorNome [1 ]);
63
+ System .out .println ("Primeiro caractere: " + cliente2 .getNome ().charAt (0 ));
29
64
System .out .println ("Renda: " + cliente2 .getRenda ());
30
65
System .out .println ("Ano de Nascimento: " + cliente2 .getAnoNascimento ());
31
66
System .out .println ("Sexo: " + cliente2 .getSexo ());
32
67
System .out .println ("Especial: " + cliente2 .isEspecial ());
33
68
System .out .println ("Aleatório: " + cliente2 .getAleatorio ());
34
69
35
-
70
+
36
71
}
37
72
}
0 commit comments