Adrien Vergnaud

Greenhorn
+ Follow
since Oct 15, 2015
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
1
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Adrien Vergnaud

Thank you for your reply

I did not correctly understand the word "underneath". If "underneath" means "inside" then I was wrong. My bad.
Hi

On page 485, question asks:


Which statement is true of the following code?
zoo.staff
|-- zoo
  |-- staff
     |-- Vet.java

...
D. The directory structure would be a valid module if module-info.java were added directly underneath zoo.staff
E. The directory structure would be a valid module if module-info.java were added directly underneath zoo



On page 526 the answer is:


D. Modules are required to have a module-info.java file at the root directory of the module. Option D matches this requirement.



It seems to me that option E matches this requirement.
Indeed the root directory of the module is zoo.staff.
I successfuly compiled and run this module with the following files:

zoo.staff\module-info.java


zoo.staff\zoo\staff\Vet.java


Do you agree with me? or did I miss something?
I do agree with you

I'm studying the great book from Boyarsky - Selikoff. And this kind of code is "study material" for the exam
Hello and thank you for your quick reply

Maybe my post was not very clear. The book states:


1. If there is a superclass Y of X, then initialize class Y first
2. Process all static variable declarations in the order they appear
3. Process all static initializers in the order they appear



But according to the StaticInit2 code example, the logic is:


1. If there is a superclass Y of X, then initialize class Y first
2. Process all static variable declarations and static initializers in the order they appear

Hello everyone

From the book OCP STUDY GUIDE Java SE 11 Programmer 1, page 317 :


1. If there is a superclass Y of X, then initialize class Y first
2. Process all static variable declarations in the order they appear
3. Process all static initializers in the order they appear



I run this code :


and it outputs "1"

This means that the static initializer has been run before the variable declaration for j

What do you think?