Lessons

Java tutorial

Java Classes

A class describes a kind of object. Fields store the object's data, and methods describe what it can do. new creates an object, and a dot reaches one of its fields or methods.

Example

Edit the code and run it again. This runner stays in your browser and covers the syntax used in these lessons.

Output

Run the example to see output here.

What this code does

The program creates a Note, stores a sentence in its text field, and calls show. That method prints the field.