Summary

We have at last written our first class. We have seen that we can implement a class in a Java file of the same name as the class. The class itself doesn't do anything until we instantiate an object/instance of the class. Once we have an instance of the class, we can use its variables and methods. As we proved in the Basic Classes app, each and every instance of a class has its own distinct variables. Just as when you buy a car made in a factory, you get your very own steering wheel, Sat Nav, and go-faster stripes.

All this information will raise more questions. OOP is like that. So, let's try and consolidate all of this class stuff by taking another look at variables and encapsulation, polymorphism, and inheritance in action in the next ...

Get Android Programming for Beginners - Second Edition 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.