Summary

After finishing today's lesson, you should have a pretty good idea of the relationship between classes in Java and programs you create using the language.

Everything you create in Java involves the use of a main class that interacts with other classes as needed. It's a different programming mindset than you might be used to with other languages.

Today you put together everything you have learned about creating Java classes. Each of the following topics was covered:

  • Instance and class variables, which hold the attributes of a class and objects created from it.

  • Instance and class methods, which define the behavior of a class. You learned how to define methods—including the parts of a method signature, how to return values from a method, how ...

Get Sams Teach Yourself Java 2 in 21 Days, 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.