You are here

Class Declaration

Get the entire book!
Java for the Beginning Programmer

Usually every Java source file defines one single class. Classes are the basic building block of Java programs. Very large applications may have hundreds, if not thousands, of classes. For now, you can think of a class as a program. Nearly every program in this book will consist of only one class. However, when we reach Chapter 13, you will learn how to create a program that has more than one class.

Classes are declared using the “class” statement. For example, the following class statement declares a class named UserInput.

public class UserInput

Inside of the classes are methods. These methods contain the actions to be carried out by the program. The most important method is the main method.

Programming Language: 

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer