Robin Z. Clark

Greenhorn
+ Follow
since Nov 03, 2017
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Robin Z. Clark

I'd never be able to wrap my head around these concepts if it wasn't for javaranch.  Thank you to ALL moderators!
Thank you so much for your response.  It makes sense to me.  And thank you for your response from yesterday too.  It helped.  The code is from the whizlab question.  I would NEVER use such awful identifiers
I am looking at a whizlabs question and I do not understand what is happening:



I did not think it was possible to instantiate an interface.  But the answer to what it outputs is IStatic.  I feel like the thing that I am not understanding is how can you instantiate an interface?  I suspect it has something to do with the {} after the instantiation.  I'm fairly certain that this is not a valid question for the OCA, but I don't care about that because I am now trying to prepare for the OCP and I want to understand the concept.

Can someone explain to me how this works?  I've tried googling and everything that I've found thus far says that you can't directly instantiate an interface.

Thank you!!
Why exactly is it not allowed to have an if statement inside a print statement?

For example:

2 weeks ago
I am planning to sit for the Spring Certification exam before the end of this year.  Originally I was planning to take the Oracle OCP exam (1Z0-809) prior to studying for the Spring Certification.  I already have the OCA (1Z0-808) certification.  Is it possible to do the Spring Certification prior to doing the OCP certification?  Or will I be too confused because I do not have good knowledge of the topics covered in OCP and not be able to comprehend the Spring topics?  

What are the pros and cons of completing the Spring Certification prior to the OCP and visa versa?

Thank you!
2 weeks ago
Perfect explanation!  My confusion was that I did not understand the assignment operator creates a new Integer object via implicit autoboxing.  

I am going to play around with some different scenarios that I think will help solidify my understanding.
1 month ago


I can't wrap my head around the idea that myObject is not changed to 5 and still remains with the value of 2?  In other words, I think that this should output "5 5", but instead it outputs "2 5".

The way that I understand this, myObject is a reference variable.  It points to an object on the heap that has an instance variable with the value of 2 at the beginning of the program.  What really happens in the MyHeadHurts method when myPrimitive is assigned to myObject?  It changes the value in the object's instance variable from 2 to 5.  Why is this not reflected in the value of myObject's instance variable in the main method?

In other words, I realize that in the MyHeadHurts method I have a copy of the address to the object, but isn't it still pointing at the same instance variable on the heap?  I hope I have explained this clearly.  
1 month ago
Thank you. That is exactly the type of idea I was looking for.
On page 228 of k&b8 question #10 about class Network I am in tears thinking maybe I should give up programming and go to school for cosmetology.
My studies are going super well thanks to the books that Kathy, Bert, Jeanne and Scott have so generously shared. In doing practice exams I am successful in answering conceptual questions.

But for questions that require tracing thru code and keeping track of the values in variables I panic and become confused. I cant keep track of everything in my head. I dont have a sufficient technique for keeping track of the values in variables on paper. All the youtube examples I've watched for tracing thru code are not relevant because the code is so much simpler than the code I am trying to decipher.

For example in the k&b8 on page 224 question #4 about class Mixer. Or page 225 question 5 about class Fizz.

I spend so much time trying to follow it and then end up guessing. I understand the rules but I get lost trying to keep track of the changing state. I cant take the exam until i become competent tracing code on a piece of paper.

Any advice or links to videos is greatly appreciated.
I might be interpreting this table incorrectly.  The operator precedence table that begins on the bottom of page 52 and is continued on the top of page 53 says that the logical operators &, ^, | have equal precedence.  Based upon testing and confirmed by this document:

 Oracle operators precedence table

the "^", bitwise exclusive or operator, has a higher precedence than the bitwise inclusive or operator.

Any clarification would be much appreciated!

Original post/question
When it says "If two operators have the same level of precedence, then Java guarantees left-to-right evaluation" I interpreted that to mean that the expression would be evaluated left to right.  Maybe what is meant is that the precedence of the operators in the table should be ordered left to right?  That seems very very confusing to me.

Operator Precedence table posted by Knute

The table that Knute referenced clearly shows that the ^ operator has higher precedence than the "|" operator.  That makes perfect sense.

I posted a topic in the book's errata thread.  Errata thread

1 month ago
Here is the first part of the table.
1 month ago
I'll try to include a picture.
1 month ago