Hello,
I just passed the exam and want to share some experience:
-
You should have a good knowledge of Post- / Pre increment operators i. e. i++ and ++i.
Assertions:
There were two questions regarding assertions that involved the fact that
assertions are not automatically but typically enabled during
test of a program
and that it is possible to enable/disable assertions on package AND class level.
Threads:
There were a lot of questions regarding Threads and object lock with
„synchronized“ and the effects of „wait and notify“.
There were programs which started a new
thread parallel to the main thread
so that main thread was competing with new thread and the output was impredictable
There was one thread with a synchronized run() method so that only one thread could
access the coding in the run method. Therefore it is assured that the run method is passed
completeley as a sequence by the current thread.
There was another program without synchronized run() method so that two threads could
share the coding in the run() method at the same time:
1. Abstract class and Interface
An abstract class can have methods with body and methods without body.
Those without body have to be declared as abstract.
When a class has a method without body, this method must be declared as
abstract and the whole class has to be declared as abstract.
An interface can only define methods with public or no access modifier.
Other modifiers or static or final are not allowed.
EQALS + HASHCODE
- The hashCode() returns the same value for two objects. The equals() method MIGHT return „true“ but
it MUSTN‘T return true.
- If two objects are equal the hashCode must return the same value.
Bye, Bye,
Thomas