Rod Taylor

Ranch Hand
+ Follow
since Aug 03, 2012
Rod likes ...
Netbeans IDE Java Ubuntu
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
45
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rod Taylor

Hello,

Can someone help me understand why the s in else clause is in scope whilst the one in positive case is not? Thank you.

8 months ago

Tim Holloway wrote:You're missing a parenthesis on line 3.


I sure was! Thank you for spotting this!

Tim Holloway wrote:
But it does return an ImmutableCollection


Where can I find ImmutableCollection class in Java 17 API documentation? It does not appear in search box..

Thank you
1 year ago
Hello all,

According to the documentation, method get() in java.util.List is an abstract method. If it's abstract, how come that method execute() below can print "dogs". I thought abstract methods have no implementation?



Thank you for your help in advance.
1 year ago

Paul Clapham wrote:The first one constructs a Long object and assigns a reference to that object to a Long variable. That is a simple and normal thing to do in Java.



But the Java 8 API says the constructor for it is Long(long value) whilst here 2 is an integer literal right?
Hello all,

Can anyone help me understand why the 2 declaration of local variables below behave differently please?



Thank you.
Hello all,

I'm planning to take OCA online soon. However I have looked at the warning from Pearson Vue regarding the use of company's laptop for the test since I don't have a personal laptop.  I have done the Pearson Vue system test and exam simulation on the laptop and it passed.

2 questions please:
1) is passing the system test enough to guarantee that the company's laptop will have no issue on the day of the test with the real Pearson Vue test?
2) has anyone done OCA using company's laptop and had no issue about it?


Thank you.

Paul Anilprem wrote:1. No, you can't have a restroom break.
2. No, you can't have a physical scratchpad. The exam application provides a virtual notepad on which you can type or draw using the mouse.

Here are some more details about the exam that you might find helpful.



Thank you very much for the answers and very useful information!
Hello all,

For those who have experienced online exam 1z0-808, I wonder if:
1) Can I use the toilet if I need to? If yes, what's the regulation?
2) Can I use scratch pad for calculation? I'm very used to drawing objects, etc for better illustration of the question.

Thank you for your help.
When line #1 is reached, is the Paper object eligible for GC? I wonder since the Object obj inside is still 'alive' since it's referenced by o.



Thank you very much for your help!
The code below shows compile error saying that "reference to 'level' is ambiguous" in Bird.

Any good explanation why? I thought, by default, interface fields are public, static, final. Whereas 'level' in Animal is not static.



Thank you in advance!
1 year ago

Campbell Ritchie wrote:if you try to convert a String from all lower case to all lower case, why not reuse the same object?


Totally agreed on this but I guess what I'm actually aiming to understand is how 'constant pooling' really works. I reckon the main point of constant pooling is to save memory on object creation. But how does JVM decide when to create an object or when to look for the same constant on the pool?
1 year ago
Hello all,

Can someone help me understand please why the result of the code below is so?

result:

false
true

Thank you for your time and answer. Much appreciated.
1 year ago
I thought inner classes can see private variables of its enclosing class and vice versa, but when I tried the code below, this is not the case, i.e. class C can see aA, bB; class B can see aA only; class A can see neither bB nor cC??

Have I done something wrong here?  

Note: Java version 8



Thank you for your answer and time! Much appreciated.
1 year ago

Stephan van Hulst wrote:This rule changed in Java 16, so you may be using a newer Java version.

When practicing for an exam for a specific Java version, it's strongly recommended that you use exactly that Java version, and not older or newer. Either you need to downgrade your Java version, or you need to get a newer study guide.



Oh wow! I didn't even realise that! Thank you for the tip!

Thank you all!