class definition - The class definition We write our first...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
The class definition We write our first Java class, in the upper right pane of DrJava. This class definition will describe the components that are placed in each manilla folder, or object, of the class. We start by putting a comment that indicates what each instance of the class has in it. /** An instance is like a JFrame but has two more methods */ We then type public , which means that this class can be referenced from anywhere else; class , which means that we are writing a new class definition; a name for the class, we choose Demo ; and an opening and closing brace. The opening brace goes on the same line with the name of the class. The words public and class appear in blue, because they are keywords and cannot be used as identifiers —as names of variables, methods, or classes. Instances of class Demo have essentially nothing in them, because we haven’t declared any components. We save this class definition, by clicking button Save . A navigation window opens, and we navigate to
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/07/2008 for the course CS 101 taught by Professor Gries during the Spring '08 term at Cornell University (Engineering School).

Page1 / 2

class definition - The class definition We write our first...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online