In this chapter, we'll start off with the minimal code for a class.
This will allow us to compile the class, and get things rolling.
Recall our previous work
defining object types
.
Let's now start off by coding the class named
Person.
Coding a Class
This is the starting point for coding a class.
It should compile
.
It is the shell that we will later fill with code.
public class Person
{ }
📋
Let's code it:
Add a new
plain text file
and name it
"Person.java"
Open the file in a
plain text editor
or
IDE
Type the code shown above into the file
Save the file
Introduction To Objects With Java (Chapter 302 - Classes)
Chapter 302 - Classes
Coding a Java Class
Chapter Contents
Overview
Naming
Example
Coding
Compiling
Header
Body
Refs
Challenge
Chapter
Top
Search
TOC