Happy Book Birthday! OCP 17 Practice Tests

Our Java 17 Practice Tests book has been released! This is a major rewrite of our Java OCP 11 book with hundreds of new and revised questions! If you already have our Java 17 Study Guide, you can purchase it individually, or you can buy it as kit.

The Practice Tests OCP 17 book contains 11 chapters helping you review and reinforce each objective. It also includes 3 full practice exams. All questions in the practice test book are unique from those in the complete study guide.

how to register for an exam using an oracle exam voucher

Note: We wrote a far more detailed version. See this post

Up until August 2022, everyone used PearsonVUE to register for the exam. Now, you sign up for an exam differently if you are taking it in English. If you are taking it another language (ex: Chinese or Japanese), you still pay thru PearsonVUE (see blog post on sign up process.)

Don’t worry. The exam is still administered through PearsonVUE.

For English exam takers, buy your voucher

  1. Go to the page to buy an exam (ensure you plan to take the exam within 6 months; vouchers expire)
  2. Scroll down to the box for “Oracle Cloud Infrastructure and Technology Exams”. Click “view details” to confirm your exam is still in the list
  3. Click “Add to cart”. It shows up as “Oracle Technology Exam Subscription” (it’s not a subscription though. You still get one attempt
  4. Sign in/pay

Sign up

Per Augusto Moro

After the payment was approved I received an email with order confirmation sent by Oracle with some instructions about how to activate the license key. 
The email contains a link to a page called Oracle Exam Attempt Administration Tool, [img]where I got an activation link to choose and schedule the exam. 
After the exam was beem scheduled, I received a schedule confirmation email with a link to manage my exam schedule and some instructions about the exam day. 

Interesting change in calling methods in Java 17

We have this code in our Java 11 practice exam book. What do you think it prints?

public class Hippo {
    private static void hippo(short num1, short num2) {
        System.out.println("shorts");
    }
    private static void hippo(int... nums) {
        System.out.println("varargs");
    }
    private void hippo(long num1, long num2) {
        System.out.println("longs");
    }
    private void hippo(int num1, int num2) {
        System.out.println("nums");
    }
    public static void main(String... args) {
        hippo(1, 5);
    } }

Reasoning it through, we know, it doesn’t print longs or nums because the main() is static and therefore we can’t be calling an instance methods. The answer is varargs because we have ints. This seems nice and reasonable.

I then ran the same code in Java 17 and it doesn’t compile!

% java17 Hippo.java
Hippo.java:15: error: non-static method hippo(int,int) cannot be referenced from a static context
hippo(1, 5);
^
1 error
error: compilation failed

i do agree that hippo(int, int) can’t be called. I was surprised at the behavior where it no longer compiles. If I remove the two instance variables, Java still prints varargs like I was expecting.