Win a copy of Python Continuous Integration and Delivery this week in the Python forum!

Charles O'Leary

Ranch Hand
+ Follow
since Jul 10, 2014
Cows and Likes
Cows
Total received
5
In last 30 days
0
Total given
0
Likes
Total received
31
Received in last 30 days
1
Total given
10
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Charles O'Leary

Charles O'Leary wrote:

Md Zuanyeed Kamal wrote:why do I get output as Finished!Joyce Hopper  . My question is why didn't try block execute first ?



The try block did execute first.  Finally always runs (except for System.exit/JVM shutdown/etc.).  In this case, it prints before the return (clause) actually returns to its caller.

You could add System.out.println("before return"); before the return statement in your try to get a better visual on this.  



To Campbell's point (and my earlier point):



output:
inside try and before return
Finished!Joyce Hopper

Campbell Ritchie wrote:How did you get that code to compile with finally before catch?

Great point Campbell.  

Md Zuanyeed Kamal wrote:why do I get output as Finished!Joyce Hopper  . My question is why didn't try block execute first ?



The try block did execute first.  Finally always runs (except for System.exit/JVM shutdown/etc.).  In this case, it prints before the return (clause) actually returns to its caller.

You could add System.out.println("before return"); before the return statement in your try to get a better visual on this.  

Mark Parent wrote:
Well, I appreciate the effort but both points do not reply to my question



I guess I failed to fully explain that whether you write "extends java.lang.Object" (unnecessarily) yourself, or perhaps let the compiler do it for you, you cannot override without extending a class.  Specifically, you may not necessarily be overriding one of Object's methods.  Rather, Object will always be in your inheritance tree ... the very definition of extending a class.  Again, I'm rationalizing here because these "word problems" sometimes aren't as precise (to us test takers sometimes, rather than test writers), when compared to a "what is the result of this code" problem.  

I hope that helps?
Mark,

On the actual exam the number of correct answers you must select is mentioned, so you could use process of elimination.    

Are they possibly suggesting that the Object Class is always always always there with respect to this statement.  Thus, one is never "truly" without at least one superclass?  (I don't know, but that's all I got.)

Hi Liza,
In making the assignment, you are "recording" the (result of the) concatenation [s2 = s2.concat("3")], rather than immediately discarding it [s2.concat("3")] since its reference is "not recorded".
Hi Liza,

Liza Sachdev wrote:hi ,

I have started reading the  OCA JAVA SE8 Programmer 1 Study Guide - Jeanne Boyarsky and Scott Selikoff  online   . Is the online material same as the hard code book ?  

 
In order to be able to properly answer, please quote your online material sources.  Personally I've used Kindle's version.  It is.  However, Kindle's version is less encouraged.

Liza Sachdev wrote:Do I need to read the other Books OCA JAVA SE8 Programmer 1 Certification guide - Mala Gupta and OCA/OCP Java SE 8 Programmer 1 & 11 Study Guide - Kathy Sierra and Bert Bates   side by side .  Please guide .


Ultimately, only you can determine what your needs are (since we all have different learning approaches, backgrounds, occupations, and/or experiences).  To help you in making that decision, you may want to try a mock exam or two.

I hope that helps.

Narayana Bojja wrote:
We didn't either declared or handled that checked exception in Dog class main method. So, We get compiler error.

Is my understanding correct ?
If wrong , Could some one  explain what is internal process for this error, please ?


Shown above, Dog's overridden method is allowed to throw fewer or no exceptions, while the superclass's Animal eat method, that is allowed to clear the compiler because it states that it throws a checked Exception that must be either handled or declared per definition of checked exception (if/when an exception does not extend RuntimeException).

I hope that helps.

 
Let's give that a try:


Dog eatsDog eats



I hope that helps.

Firstly, I have only 15 days more for my final exam.


You will do this.  If you feel you need to for right now, you could always reschedule.  The Ocajp Wall of Fame is here to help to serve as inspiration for each of us.

Stepped onto enthuware to test my understanding, resulted in a disheartening score.


I dont know where iam weak.  


Enthuware's "Exam Objective" serves as a guide in understanding review materials.  The Sybex study guide, as well as other guides, outlines objectives for review as well, that particularly come in handy if and when we answer a question incorrectly.  

And a Warm Welcome to the Ranch!
Very inspiring!  Thank you!

... and ...

Welcome to your first Ranch posting!
Welcome to the Ranch!


From the Sybex Study Guide (I very highly recommend it, if you don't already have it.)