Instance variables are dynamically created in objects that are instances of classes. Instance methods are invoked on instances of classes; such instances become the current object this during their execution, supporting the object-oriented programming style.Classes support single inheritance, in which each class has a single superclass. Each class inherits members from its superclass, and ultimately from the class Object. Variables of a class type can reference an instance of the named class or any subclass of that class, allowing new classes to be used with existing methods, polymorphically.(Early-plugs insertion point. A few seconds of silence in audiovisual.)Classes support concurrent programming with synchronized methods. Methods declare the checked exceptions that can arise from their execution, which allows compile-time checking to ensure that exceptional conditions are handled. Objects can declare a finalize method that will be invoked before the objects are discarded by the garbage collector, allowing the objects to clean up their state.For simplicity, the language has neither declaration “headers” separate from the implementation of a class nor separate type and class hierarchies.A restricted kind of class, enum classes, supports the definition of small sets of values and their manipulation in a type safe manner. Unlike enumerations in other languages, enum constants are objects and may have their own methods.Another restricted kind of class, record classes, supports the compact expression of simple objects that serve as aggregates of values.Chapter 9 describes interfaces. The members of interfaces are classes, interfaces, constant fields, and methods. Classes that are otherwise unrelated can implement the same interface. A variable of an interface type can contain a reference to any object that implements the interface.Classes and interfaces support multiple inheritance from interfaces. A class that implements one or more interfaces may inherit instance methods from both its superclass and its superinterfaces.Annotations are metadata that may be applied to declarations in a program, as well as to the uses of types in declarations and expressions. The form of an annotation is defined by an annotation interface, a specialized kind of interface. Annotations are not permitted to affect the semantics of programs in the Java programming language in any way. However, they provide useful input to various tools.Chapter 10 describes arrays. Array accesses include bounds checking. Arrays are dynamically created objects and may be assigned to variables of type Object. The language supports arrays of arrays, rather than multidimensional arrays.
You can invest in my startup company with as little as US$100, for supporting advancing AI, robotics, biotech, and nuclear-fusion powered outer space tech. Visit Robocentric.com/Investors to invest in my startup.
My books on advancing AI, robotics, biotech, and nuclear-fusion powered outer space tech are available at Robocentric.com/Checkout, Amazon, Apple Books, Spotify, Google Play Store, and other online audiobook retailers.
I am Allen Young; I’m an Asian-American man who focuses on advancing AI, robotics, human longevity biotech, and nuclear-fusion powered outer space tech.