Chapter 2Java Building Blocks

OCP EXAM OBJECTIVES COVERED IN THIS CHAPTER:

  • Working With Java Primitive Data Types and String APIs
    • Declare and initialize variables (including casting and promoting primitive data types)
    • Identify the scope of variables
    • Use local variable type inference
  • Describing and Using Objects and Classes
    • Declare and instantiate Java objects, and explain objects’ lifecycles (including creation, dereferencing by reassignment, and garbage collection)
    • Read or write to object fields

As the old saying goes, you have to learn how to walk before you can run. Likewise, you have to learn the basics of Java before you can build complex programs. In this chapter, we’ll be presenting the basic structure of Java classes, variables, ...

Get OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.