Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!

Roel De Nijs

+ Follow
since Jul 19, 2004
Roel likes ...
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
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
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Roel De Nijs

Kelvin Okornoe wrote:b.h will print 4, Because variables are invoked using the reference type than the Object at runtime, and b.getH() will invoke the Beta version of the method at runtime. When it gets to which variable is printed in class Beta. Beta's variable h gets printed and returned.
Please correct me if am wrong!.

Let's get really nitpicky b.h will print nothing (System.out.println will do the printing, not b.h)! b.h will evaluate to 4 (the reason why you've explained correctly). b.getH() will invoke the getH() method from Baap, but at runtime the getH() method from Beta is executed.

Here are two very simple (and hopefully easy to remember) but very, very, very important rules (which you must know by heart):
  • Which instance variables you can access is determined at compile time based on the reference variable type.
  • Which instance methods you can call/invoke is determined at compile time based on the reference variable type. Which instance method is actually executed is decided at runtime based on the type of the actual object (= polymorphism).

  • Here is a very, very, very important rule: The compiler doesn't execute any code! So every compiler error you get, is because the compiler knows something is wrong without executing any line of code. So the compiler doesn't know and care) about the actual objects, the compiler only knows about the types of the reference variables.

    Hope it helps!
    Kind regards,

    Kelvin Okornoe wrote:That is the method statement prints before the variable.
    And I keeping asking myself why?

    That's very well explained in this post. Definitely worth reading!

    Kelvin Okornoe wrote:Someone help me understand why?

    This code snippet (and its output) is already explained in great detail in this topic. So I'm pretty sure when you have carefully read this excellent topic you'll have a perfect understanding why this output is printed. If you still have doubts and/or questions, just let us know by replying to this topic.

    Hope it helps!
    Kind regards,
    Hi John,

    Congratulations champion! Great achievement Now it's time to relax a bit and have a (well-deserved) (or 2 or 3). And if you want to spoil yourself have a Belgian beer, our beers are the best of the world

    Thanks for sharing your experiences. Other ranchers will definitely benefit! Have a cow!

    Don't forget to add your name to the OcajpWallOfFame!

    Kind regards,
    9 months ago

    Nikhil Nagrale wrote:ii) Should I wait for OCAJP 9 ? or take OCAJP 8?

    Just take OCAJP8 and OCPJP8. When Java 9 certification exams are available, you can upgrade to OCPJP9.

    Vidya Shivram wrote:what are the tips/tricks is to easily identify unreachable code?

    Luckily for you, the "unreachable code" topic is one of the more popular ones in this forum. So using the search function you'll find plenty of topics about "unreachable code". Here is a list which could probably be added to my certification book
  • return value for method.
  • Confused point about infinite loop
  • continue and break in a loop would generate compilation error?
  • Which of these is unreachable code?
  • Unreachable Code
  • Which is the first line to cause error?
  • Maybe "unreachable code" should be "dead code" in page 70, (Java OCA 8 Programmer I Study Guide)
  • Throwing a second exception question
  • System.exit() and unreachable code
  • good examples of unreachable code?

  • I think you know what to do now

    Hope it helps!
    Kind regards,
    OP has shared her experience about her journey and preparation for the certification exam in this topic. Very detailed and definitely worth reading!
    10 months ago
    Hi Angello,

    Congratulations champion! Great achievement Now it's time to relax a bit and have a (well-deserved) (or 2 or 3). And if you want to spoil yourself have a Belgian beer, our beers are the best of the world

    Thanks for sharing your experiences. Other ranchers will definitely benefit! Have a cow!

    Don't forget to add your name to the OcajpWallOfFame!

    Kind regards,

    Heather Barnes wrote:The one thing I didn't do as consistently was write snippets of code for each concept - I focused more on doing this for areas I often got confused on. Is this maybe where I missed in my preparation?


    Learning a programming language is like driving a car: you don't learn how to drive a car by just reading a book (a few times), you have to get your hands dirty. During your preparation you should definitely write a boatload of small code snippets, preferably using your favourite text editor, javac (to compile your code) and java (to run your code). On the exam you need to assess code snippets, spot compiler errors, select the correct output,... (without an IDE). Each code snippet in the study guide should be the starting point to do plenty of experiments (change access modifier, change return type, add throws clause, mark an instance method static or final, and so on). And before you compile (and run) the program, you try to predict what will happen after you made the changes. Then you compile the program (and if it successfully compiles, run it as well) and see if your expectations/thoughts were correct.

    Heather Barnes wrote:Failed first attempt at Java OCA exam

    Sorry to hear you have failed the certification exam!

    Heather Barnes wrote:On exam day, I felt prepared but got tripped up on the first few questions and didn't manage my time well creating a time crunch at the end and ended up guessing on about 7 questions at the end blindly with no time to even read them. Needless to say, I didn't re-check my answers either.  The final result was a 50%. I want to sit for it again in a few weeks but unsure of how to proceed from here.

    I might be wrong here, but you'll need much more time to thoroughly prepare yourself for your second attempt than a few weeks. I assume it will more likely be a few months. Because you clearly don't have the Java knowledge to pass this exam. Your final score was 50% so you answered 35 out of 70 questions correctly. Even if you ignore the 7 questions you answered blindly at the end of the exam, you would have scored 35 out of 63 which is 55.5% and that's still a significant failure. And that might sound (very) harsh, but it's a fact! And although you answered these questions without reading, there's a chance you have answered one (or even two) correctly which means your score would be even lower if we ignore these questions.

    Heather Barnes wrote:I had been doing okay on the practice tests for Enthuware - anywhere between 65 and 85 %

    For me that's very hard to believe. If you consistently scored between 65% and 85% on your first attempt of an Enthuware exam, your actual exam score should have been higher than 50%. But since you have mentioned "memorizing" in your explanation, you'll probably have taken each exam multiple times and then your mock exam score is completely useless (because you'll answer questions correctly based on memorization instead of actual knowledge).

    Do I re-take all the Enthuware tests but more closely monitor time on each question? Are there other practice tests sources I should try where I haven't seen the questions so much? What do you guys suggest? I don't wan to overuse the same resources and get over-confident, however, I don't want to use bad practice tests either.

    I assume you have a detailed score report indicating which are your weaker exam topics/objectives. Before taking any other mock exams, you have to study first. Read through the study guide again and maybe even purchase another one to get some other insights (point of views) and probably some additional sets of mock questions as well. If you have taken Enthuware mock exams multiple times, it's probably useless to give a good indication of your readiness for the actual exam. So that's why you need to have a few other mock exams (e.g. from another study guide).

    You also didn't provide much information about how you have prepared. Did you only read/study the study guide and then took mock exams? Did you write loads of small code snippets? Did you use an IDE when writing code snippets? Also when you have taken a mock exam, you should always read the explanation, even if you answered the question correctly! And the reason why: you might have answered the question correctly for another (incorrect) reason.

    And finally, if you use the search function, you'll find plenty of topics with advice to prepare (and ace) the OCA exam. Here are a few:
  • Studying so hard just to fail(1z0-808)
  • Failing Java SE 8 Programmer I
  • Bad Experience with OCA 7 exams
  • Any tricks about how to manage the 120 min for so many question?
  • second failed OCAJP
  • Need some advice after failing the exam

  • Hope it helps!
    Kind regards,
    And don't forget there's no negative marking for a wrong answer, so you can guess for free
    For such posts it's always a nice thing to mention the actual study guide.

    Lilou Laure wrote:I would like to know your views on this , from you all ! Is it that there are certain exams sets that are quite hard and so it may not always be possible to score higher than the Enthuware mock average ?

    I don't think there are actual exam sets. I think there's a question bank with e.g. 500 questions. And for every exam the number of questions are chosen randomly from this question bank but with enough coverage for each exam objective. So you might have been a bit unlucky and have gotten a few harder ones or maybe you had one or two weaker areas and got 5-6 questions on these topics (while the guy/girl next to you got only 3).

    When I took the SCJP 6 certification exam (a long time ago), I noticed more questions than usual were "do not compile" ones. Probably the easiest Java certification exam of the three SCJP exams I have taken. You'll find more details if you click on the corresponding link in my signature.
    Sometimes patience is a virtue

    Are you able to see your results now? And is your CertView account configured correctly?