local variable type inference with instance and static initializers

Local type variable inference is the formal name of “var” in Java. From the name, you might deduce some things about allowed or disallowed locations. For example, a local variable in a method is allowed and an instance variable declaration is not.

Scopes that are even more granular are also allowed such as inside a for loop or try with resources statement.

I learned today that instance and static initializers are allowed as well.

public class LVTI {
public int myValue;
{
var temp = 3;
myValue = temp;
}
}
}

In hindsight, this makes sense. An initializer is a block of code. Which can have local variables.

For more on local variable type inference, please see the official style guidelines.

Choosing an exam: Java Foundations vs OCP 11

Update (11/05/2020): Read The 1Z0-819 Exam page to learn how you can easily our Java 11 Study Guides to prepare for Oracle’s 1Z0-819 Exam, as well as the 1Z0-817 Upgrade Exam.

Three years ago, I wrote about why you should take the OCA 11 rather than the Java Foundations exam. Now that the Java 11 cert is out, the situation changes.

Java Foundations vs OCA 8 (1Z0-815)

Until the OCA 8 is discontinued, I think everyone considering the Java Foundations exam should take the OCA 8. The reasons in my original blog post still apply:

  • The OCA 8 is not that much more difficult than the Java Foundations exam. It’s definitely in reach for an entry level programmer.
  • Taking the OCA 8 lets you use it as a pre-req for a later exam. You can take either the OCP 8 (IZ0-809) or OCP 11 part 2 (IZ0-816). This means you will only need to take one more exam to become OCP certified.

So when should you take the Java Foundations exam:

  • Cost: The Java Foundations exam costs less than half the price of the OCA 8. If you can’t afford the OCA, this is an option.
  • Requirement: If you took a course that requires the Java Foundations or lets you take it for free.

Java Foundations vs OCP 11 part 1 (1Z0-815)

With Java 11, it’s a harder decision deciding which exam to take because:

  1. The OCP 11 part 1 (1Z0-815) is significantly harder than the OCA 8 (1Z0-808). The OCP 11 part 1 is still in reach of an entry level programmer, but it is more work.
  2. Passing the OCP 11 part 1 does not give you a certification. Another (even harder exam) is needed for that.

So who should you take the Java Foundations exam:

  • Time: If you don’t have the time to study for two harder exams, the Java Foundations exam gets you a certification faster.
  • Cost: The Java Foundations exam costs less than half the price of the OCP 11 part 2 and a quarter the cost of the OCP credential.
  • Requirement: If you took a course that requires the Java Foundations or lets you take it for free.

Just be aware that taking the Java Foundations exam does not serve as a prerequisite to later certification exam. If you plan to get OCP certified in the future, be aware that the Java Foundations exam is a one off.

Oracle now offers online proctored exams

When signing up for a cert exam from Oracle (via PearsonVUE), you now get asked whether you want to take it “at a local test center” or “at my home or office.”

The online option sounded interesting so I clicked on it and went to the Online Proctored exam page. The gist is that if you can meet certain requirements, you can take the exam from home.

Computer requirements

Computer requirements are pretty standard. Any modern computer with Mac/Windows/Linux should be fine. Don’t take it over the corporate network though; it doesn’t play well with corporate firewalls.

Room requirements

The room requirements are where this falls apart for me. You have to be a walled room with a door. I live in New York City.; apartments are small. My apartment has two doors – one to get into the apartment and one for the bathroom. Everything else is one big room.

You also have to use your webcam to show that you aren’t in arm’s reach of books/notepads/post-its/papers/pens/pencils/etc. Additional monitors must be unplugged. Looking around, I have *a lot* of stuff within arms length. It would take a while to move things even if I had a room with a door.

Privacy

You have to be alone in the room. So prepare your family/roommates.

No Breaks

Ou are not allowed to take a bathroom break. I’ve never needed one during the exam. But it is three hours and some people do. In an exam center, you are allowed to go to the bathroom. It counts against your time, but you can go.

No writing

You aren’t allowed to write anything down. At the exam center, you can trace variables, write down questions to go back to etc. You have to return the paper at the end. Since this can’t be done at home, I understand why they can’t let you write anything down. However, I think it would be really hard to take a Java cert without writing anything down.

My thoughts

While I can’t do this, I think it is a good option for folks who have more space and/or live further away from a testing center. The not writing things down limitation would be hard though!