Helene Shaikh

+ Follow
since Mar 25, 2016
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Helene Shaikh

Hi Jeanne,

Thank you for the answer. But i'm still missing something related to file structure:

=> why doesn't this output ./cat2.html? . (dot) refers to the current directory. Isn't Test the current directory for both cat.html and cat2.html? If you're inside cat.html and you want to navigate to Test, you just use .(dot) if I'm not mistaken.

2. I don't quite understand your explanation concerning my first code snippet. When you're in /Test/cat.html and you want to go to the root, why do you have to go up 2 directories?

Could you please explain to me in great detail the steps taken to achieve those results? Thank you so much in advance and sorry for the trouble

Hi all,

I have a question regarding the isHidden() method when you use it on Mac. I have effectively hidden the file .test within this directory: /Users/somename/documents/.test . A dot hides a file/directory in Mac.

However, this returns false and I don't understand why:

When I use a dot (which hides files in mac) it returns true, all of the time, even if the file doesn't exist:

How can the last example also return true "if the file is available and hidden within the file system, the method will return true" (page 480). And most importantly, why doesn't the 1st piece of code return true?

Thanks in advance for helping me out
Hi all,

I'm trying to understand how the relativize() method works but I can't figure it out. Here's a code sample:

Code snippet 1

Code snippet 2

In both cases, I don't understand the output at all. If someone could please help me to clear out that one I have of course read the explanation in the book, but it's still not clear to me.
Thank you,

Also, when I use a constructor without arguments, my code still outputs age 3 and type 'c'. But the explanation on page 432 states that "when the object is deserialized, no class constructor or default initializations are used"

Hi all,

I have a question regarding static & transient members:

Considering that "transient variables and static class members are ignored during the serialization and deserialization process" (page 427):
1) Why does my code output the static char type ('C' in this case)?
2) When I read my transient String, it still outputs null, why? "it is important to check for null values when reading from a serialized data stream. We rely on the instanceof operator to always return false for null values". (page 431)


For those learning about concurrency =

I came across a famous example for learning about synchronization and liveness issues called "The Dining Philosophers Problem". Wanted to share it with fellow students who have no experience with it.

Thank you very much Brandon Lewis! Your examples were exactly what I was looking for.
Hello all,

I have a question regarding the time between serial streams and parallel streams. In the following example, the serial stream processes the results faster than my parallel stream. Can anyone explain this behaviour please? Or point to me what I am doing wrong?

Thank you for the help!

On page 374 of the OCP 8 Programmer II, the authors list the requirements needed to use reduce() on parallel streams. However, I don't understand a thing about the explanations given after each bullet point. I know how the reduce() method works, I just don't understand the rules.

■ The identity must be defined such that for all elements in the stream p ,
combiner.apply(identity, p) is equal to p .

■ The accumulator operator op must be associative and stateless such that (a op b) op c
is equal to a op (b op c) .

■ The combiner operator must also be associative and stateless and compatible with the
identity, such that for all p and t combiner

Thank you in advance for the help!

Given the following resource bundle, how do I iterate through it using a traditional for loop (no streams)?

Thanks for the help!
Thank you for the help! I understand everything now.
Same issue with

Hi everyone,

I don't understand why the following code doesn't compile:

B is a supertype of C & the list is instantiated as an ArrayList of type B. So why can't I add a B object to the list?

Thank you in advance,