You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Além de validar conceitos importantes da linguagem Java a prova de certificação também exigirá que você esteja atento a detalhes específicos nos códigos de cada questão. Sem o auxílio da IDE, você será o compilador.
5
+
In addition to validating important Java language concepts, the certification exam will also require you to be aware of specific details in the codes of each question. Without the help of the IDE, you will be the compiler.
6
6
7
-
Veja alguns exemplos simples que se mostram óbvios mas podem te enganar na hora de marcar a resposta certa.
7
+
Here are some simple examples that are obvious but can trick you into marking the right answer.
8
8
9
-
=== Cenário 1
9
+
=== Scenario 1
10
10
11
11
[source,java]
12
12
----
@@ -19,29 +19,29 @@ class Duke {
19
19
}
20
20
}
21
21
----
22
-
. Compila e imprime "Java6"
23
-
. Compila e imprime "Java8"
24
-
. Não compila
25
-
. Compila, mas ocorre um erro durante a execução
22
+
. Compile and print "Java6"
23
+
. Compile and print "Java8"
24
+
. Not compile
25
+
. Compiles, but an error occurs while running
26
26
27
-
Sem pensar muito a reposta seria a _opção 1_, certo? Errado. Olhando mais atentamente ao código é possível notar que na primeira linha do método `main` está faltando um `;` (ponto-e-vírgula). Esse pequeno detalhe mostra que a opção certa é a 3.
27
+
Without thinking too much the answer would be _option 1_, right? Wrong. Looking more closely at the code, you can see that the first line of the `main` method is missing a `;` (semicolon). This little detail shows that the right option is 3.
28
28
29
29
[TIP]
30
30
--
31
-
Sempre que existir uma resposta falando _código não compila_, verifique duas vezes as regras de compilação antes de testar o comportamento do código e sua possível resposta.
31
+
Whenever there is a response saying _code does not compile_, double-check the compilation rules before testing the code's behavior and its possible answer.
32
32
33
-
.Checklist mental para validar uma compilação
34
-
* Ponto-e-vírgula
35
-
* Visibilidade
36
-
* Escopo de variáveis
37
-
* Nomes e parâmetros de métodos
33
+
.Mental checklist to validate a build
34
+
* Semicolon
35
+
* Visibility
36
+
* Scope of variables
37
+
* Method names and parameters
38
38
* ...
39
39
--
40
40
41
41
- - -
42
-
_Resposta: 3_
42
+
_Answer: 3_
43
43
44
-
=== Cenário 2
44
+
=== Scenario 2
45
45
46
46
[source,java]
47
47
----
@@ -54,17 +54,17 @@ class Duke {
54
54
}
55
55
}
56
56
----
57
-
. O código compila e roda, imprimindo "Java8".
58
-
. O código não compila.
59
-
. O código compila e roda, imprimindo "Java6".
60
-
. O código compila mas dá erro em execução.
57
+
. The code compiles and runs, printing "Java8".
58
+
. The code does not compile.
59
+
. The code compiles and runs, printing "Java6".
60
+
. The code compiles but gives error in execution.
61
61
62
-
Se você escolheu a opção 1, você errou... Esse exemplo tem outra pegadinha com o conceito de _shadowing_. Usa-se o mesmo nome de váriável mas com um escopo diferente. Inicialmente o tipo `int` engana sua reposta mas esse código não compila ao tentar atribuir um valor `int` à uma variável do tipo `String[]`.
62
+
If you chose option 1, you got it wrong... This example has another catch with the concept of _shadowing_. The same variable name is used but with a different scope. Initially the `int` type misleads its response but this code does not compile when trying to assign an `int` value to a `String[]` variable.
63
63
64
64
- - -
65
-
_Resposta: 2_
65
+
_Answer: 2_
66
66
67
-
=== Cenário 3
67
+
=== Scenario 3
68
68
69
69
[source,java]
70
70
----
@@ -76,26 +76,26 @@ class Duke {
76
76
}
77
77
}
78
78
----
79
-
. Imprime `1`
80
-
. Imprime `0`
81
-
. Imprime `false`
82
-
. Imprime `true`
83
-
. Imprime `null`
84
-
. Erro de execução
85
-
. Não compila
79
+
. Print `1`
80
+
. Print `0`
81
+
. Print false
82
+
. Print `true`
83
+
. Print `null`
84
+
. Execution Error
85
+
. Not compile
86
86
87
-
A escolha mais comum seria a opção 3, onde confirma que o valor padrão de cada posição de um array do tipo _boolean_ é _false_. Esta opção estaria certa, se não fosse uma pegadinha. Este código na verdade *não compila*. A opção certa seria a número 7. Isso porque a variável _dukeClones_ é um _boolean_ simples tentando receber um array do tipo _boolean_.
87
+
The most common choice would be option 3, where it confirms that the default value of each position of an array of type _boolean_ is _false_. This option would be right if it wasn't a catch. This code actually *does not compile*. The right option would be number 7. That's because the _dukeClones_ variable is a simple _boolean_ trying to get an array of type _boolean_.
88
88
89
89
[TIP]
90
90
--
91
-
Em uma inicialização implícita como membro de uma classe, ou cada posição de um array, etc, a variável recebe o valor padrão respeitando a seguinte regra:
91
+
In an implicit initialization as a member of a class, or each position of an array, etc., the variable gets the default value respecting the following rule:
92
92
93
93
* _boolean_ -> *_false_*
94
-
* _char_ -> *vazio*, equivalente a 0
95
-
* Primitivos numéricos inteiros -> *0*
96
-
* Primitivos numéricos com ponto flutuante -> *0.0*
Copy file name to clipboardExpand all lines: B-test-yourself.asc
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
[[B-test-yourself]]
2
2
[appendix]
3
-
== Teste seu conhecimento!
3
+
== Test your knowledge!
4
4
5
-
Hora de colocar em prática tudo que foi visto neste livro. Existem algumas opções gratuitas e várias opções pagas. A opção mais interessante para ambos os casos é a *Whizlabs*.
5
+
Time to put into practice everything that has been seen in this book. There are some free options and several paid options. The most interesting option for both cases is *Whizlabs*.
6
6
7
-
Todos os testes listados abaixo são em inglês, provavelmente o mesmo idioma que você fará seu teste.
7
+
All tests listed below are in English, probably the same language as you will be taking your test.
8
8
9
-
IMPORTANT: Todas as opções são referentes à prova _1Z0-813_ (atualização do Java 6 ou inferior para o Java 8).
9
+
IMPORTANT: All options are for test _1Z0-813_ (Java 6 or lower upgrade to Java 8).
0 commit comments