Day 6. Creating Classes and Methods

If you're coming to Java from another programming language, you might be struggling with the meaning of the term class. It 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, the meaning of class will be clarified as you create classes and methods, which define the behavior of an object or class. You undertake each of the following:

  • The parts of a class definition

  • The creation and use of instance variables

  • The creation and use ...

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.