Chapter 6. Creating Classes

If you're coming to Java from another programming language, you might be going through a class struggle. The term “class” seems synonymous to the term “program,” but you could be uncertain of the relationship between the two.

In Java, a program is made up of a main class and any other classes that are needed to support the main class. These support classes include any of those in Java's class library you might need (such as String, Math, and the like).

Today you go to the head of the class in terms of what you know on the subject. You create classes and read about each of the following:

  • The parts of a class definition

  • The creation and use of instance variables

  • The creation and use of methods

  • The main() method used in Java ...

Get Sams Teach Yourself Java™ 2 Platform in 21 Days Professional Reference 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.