Summary

You have now covered two of the four cornerstones of object-oriented programming: abstraction and encapsulation. This section summarizes what we've seen.

OOP is all about special support for class types and the operations on them. Objects are variables whose type is a class. Classes, objects, and methods belong together in a unbreakable way. The methods in a class can only be invoked on objects that belong to that class. If you don't have an object, you cannot invoke one of the object methods. You cannot write a method in class A that is invoked on an object of some unrelated class B. There is no way to get that past the compiler in Java.

There are no structures or records in Java. The most important way to group related things is to put them in a class. You also put classes together into a package. Packages are usually implemented as directories in the file system, though the JLS doesn't demand that. You can have nest packages within a package. This is called a sub-package.

The rest is just details (although there are a lot of them). We've touched on constructors and hinted about inheritance. This is a short summary, but the concepts are critical to object oriented programming and being an effective Java programmer. It's a good idea to turn the corner of this page down, and come back periodically to ensure the concepts stick.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.75.165