Help coderanch get a
new server
by contributing to the fundraiser

John Wilson

Greenhorn
+ Follow
since Dec 04, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by John Wilson

Received the emails and info to download. Thanks for taking care of it!
7 years ago
Hello, I was a winner in the Docker in Practice book promotion. Received the confirmation of my contact info on May 19th... and that's the last I ever heard about it.
Requested an e-book, so thought it would have arrived by now? Is 4 months and counting standard for such things? Or has something happened.

Thanks.
7 years ago
Thanks for the detailed response Aidan, sounds like there is a lot of valuable information and insights packed into the book. I have a feeling I'll be learning a lot and look forward to reading it cover to cover.
8 years ago
I see in the About the Book section a mention of deploying microservices, but do not see any mention of microservices in the table of contents. Does the book contain much discussion of microservices and the role and usage of docker when developing microservices? Or setting up containers to be used in a microservice architecture?
8 years ago
Digging this thread up as I was reviewing this objective... I too was confused, not finding any distinction in the API for the listed exceptions and errors, then remembered seeing a table in the Sierra/Bates SCJP 6 Study Guide.

According to that we have:

Thrown by JVM:
NullPointerException, ArrayIndexOutOfBoundsException, ClassCastException, StackOverflowException, ExceptionInInitializerError, NoClassDefFoundError

Thrown Programmatically:
NumberFormatException, AssertionError, IllegalArgumentException, IllegalStateException

Like others have said, when you understand when/why each is thrown, it becomes fairly obvious whether they are thrown by the JVM or programmatically, but having a list helped dispel any doubts I had, and made it more obvious to me why they were categorized that way.

N Sam wrote:Thanks for posting this code. I have a question on line 82 & 83:


This seems to declare a static variable called myStaticB, but its type is B. Coming inside the declaration of class B, this seems to have a recursive definition. Obviously this is syntactically correct, but the recursive look is causing confusion to me. Can someone explain this piece of code ?



You may be over thinking this one. It is just declaring myStaticB as a static reference variable of type B. It is probably just in there to demonstrate when static variables get initialized. It only gets used on line 11: where it is assigned to a local reference variable, which, unless I'm wrong, doesn't really do anything, since myStaticB would initialize with a default value of null, b1 was explicity declared as null, so assigning myStaticB to b1 they are both still null. See, confusing. Just understand that it is initializing a static reference variable of type B.

N Sam wrote:
The other line of code that confuses me is line 26


How come this call to the constructor ends up calling 2 constructors of class A ? The printout shows

I can understand all the output until then, and i see that first this code would call public B(string s). How come the empty constructor of A gets called from here ? Is this because of extending the base class ? I am not upto reading about inheritance in java , but understand the basic principles of inheritance.



It's all about the constructors. Calling the B constructor that takes a string "b", calls this() for the no-arg B constructor, which the compiler will insert super() as the first line since there is no super() or this() already there. So super() calls the superclass constructor, in this case the no-arg constructor of A, which has a this("s") which calls the A constructor that takes a string. Once you study constructors more it will make more sense.
I tried to register with my real name, but even though my login name was unique, my registration was kicked back since my display name was already in use. Seems a small flaw in the system of using real names for anyone with a common name.
10 years ago