Mikalai Zaikin

Bartender
+ Follow
since Jun 04, 2002
Merit badge: grant badges
Forum Moderator
Mikalai Zaikin currently moderates these forums:
Cows and Likes
Cows
Total received
43
In last 30 days
0
Total given
1
Likes
Total received
310
Received in last 30 days
8
Total given
508
Given in last 30 days
11
Forums and Threads

Recent posts by Mikalai Zaikin

Anil Philip wrote:
Thank you! (but I did about 1000 practice test questions from the Boyarsky-Selikoff PT book)
Also please see my post above on the unsorted binary search question.



IMHO, Enthuware questions more closely follow pattern of the real exam...
Regrding binary search in the unsorted list -- I have reported this question, as far as I know it was addressed, but for some reason not updated in the question bank..;-(
Hi Anil !

Sorry to hear you failed.

I tend to agree with you that modern Java exams more difficult than older. Maybe because scope has increased significantly, or Oracle has different understanding than Sun Microsystems how exam should look like.

Let me quote your word which I think led to the failure:

Anil Philip wrote:
Recently purchased it and have started doing the mock exams.



I am pretty much sure if you took all exams from Enthuware and read all explanations your chances to pass would be much higher.

Regarding serialization -- if parent class is serializable, then all subsclasses are serializable too. The only limitation -- new attributes in sub-class also must be serializable in order to serialize successfully.

There is an often question -- why would not Object is done serializable and then all classes wil be serializable too, and the answer is because there are some classes like Threads, Sockets which should not be serializable (does not make sense), and therefore  it's dangerous to apply Serializable to Object. But, most of Java classes representing values: primitive wrappers (e.g. Integer), String, Date, Date/Time API (Instant, Duration) are serializable.

Take care and good luck,
MZ
could it be related to duplicated periods here:



2 weeks ago

Aziiz Ahmed wrote:I just earned the certification with 72% , when i open Credly i didn't find the badge.
Oracle certification Badges are no longer being issued from Credly for these credentials.
This mean we just share the https://brm-certification.oracle.com/ ?



Hi Aziiz !

Welcome to CodeRanch !

Yes, Oracle does not support publishing to Credly.
Can you put a breakpoint here:
3 weeks ago
Hi Anil:

I am glad you use our sample quiz for Java learning.

If you are using ItelliJ Idea (even free Community edition) you can use advanced debugger feature to check how pipeline processes data.

Hope screenshots explain it.
4 weeks ago
There is one trick here:

Deer.hasHorns access modifier is private.

For this reason, even while we have Reindeer instance (Deer deer = new Reindeer(5);), polymorphism is not working, and code will call Deer's implemenattion, hence "false" is printed   .

Be careful  
Also, we can talk in terms of "recoverability".

The true deadlock (IMHO) can never be recovered.

And the code above can be recovered for example by some daemon threads



which may be ignored (as main thread ends before t1 and / or t2 even started) if we had 12 Runnable like this



but since the main thread is blocked, the daemon threads will always run and will "programmatically" "recover" the situation.

Just 2 cents...
I tend to agree with you because the classic example of a deadlock involves two threads interlocking with each other by using 2 locks.
The code just shows a thread waiting for a finish on a blocking method of a common resource.
So, maybe a better answer could be "Code never ends", or from existing options "None of the above"

Anil Philip wrote:In the Boyarsky-Selikoff OCP 1Z-829, Chap 12 page 694



Please always refer to the original documentation:
https://docs.oracle.com/en/java/javase/17/docs/specs/man/jdeps.html

Anil Philip wrote:Sybex 829 Chapter 12

A key point to remember is that code on the classpath can access the module path. By contrast, code on the module path is unable to read from the classpath.



I was trying to understand this and am wondering whether it is correct to conclude that you cannot use both classpath and modulepath together?

Is that why code on the module path is unable to read from the classpath?
Because both the classpath and modulepath are just a list of directories that one specifies on the command line for java and also javac.



You need to think not by directory categories, but by module categories ;)

1) When you have module options in the command line, the program runs as a modular
2) All content of the classpath goes to the unnamed module
3) A named module cannot read the unnamed module, because the unnamed one has no name, so cannot be listed in the module descriptor as required ;)
4) Unnamed module (containing classpath classes) implicitly exports all packages and implicitly requires all modules from the module path
For this reason, classes from classpath can see classes from modules (as long as modular packages are exported)

Hope this helps ;)

Campbell Ritchie wrote:

Mikalai Zaikin wrote:. . . Please check the documentation . . .

Agree. But if you look here, you will find -d does something completely different for the javac tool.



Thanks, I am aware what it means in javac ;-)

But the question was about java and jar tools...