What Is an Object?
Objects share two characteristics: They all have state and behavior. An object stores its state in fields (variables in some programming languages) and exposes its behavior through methods (functions in some programming languages).
Bundling code into individual software objects provides a number of benefits, including: Modularity, Information-hiding, Code re-use and Pluggability and debugging ease.
What Is a Class?
A class is the blueprint from which individual objects are created.
What Is Inheritance?
-
Object-oriented programming allows classes to inherit commonly used state and behavior from other classes.
-
Each class is allowed to have one direct superclass, and each superclass has the potential for an unlimited number of subclasses.
What Is an Interface?
- Interface allows a class to become more formal about the behavior it promises to provide. Interfaces form a contract between the class and the outside world, and this contract is enforced at build time by the compiler.
What Is a Package?
A package is a namespace that organizes a set of related classes and interfaces.
An interface declaration consists of modifiers, the keyword interface, the interface name, a comma-separated list of parent interfaces (if any), and the interface body.
Interface is a reference type, that can contain only constants, method signatures, default methods, static methods, and nested types.
You can use interface names anywhere you can use any other data type name. If you define a reference variable whose type is an interface, any object you assign to it must be an instance of a class that implements the interface.
Multiple inheritance of implementation is the ability to inherit method definitions from multiple classes. Java supports multiple inheritance of type, which is the ability of a class to implement more than one interface.
