A Peek at Java …

Java is all about objects. A Java object is little bundle of data and code that typically represents a thing, possibly something in the real world like a book but possibly something more abstract like a stack or a queue. The data in objects is organized as fields, named values attached to the object. So an object that represents a book might have fields called title and author.

Every Java object is associated with a class. It’s an object’s class that determines exactly which fields and which methods the object carries. Classes typically also specify a constructor, a special bit of code that gets called when a new object is created. It’s the constructor that initializes the fields on an object and otherwise gets it ready to ...

Get Getting Clojure now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.