Points

What is a class?

Fields say what an object is

Methods say what an object does

class TwoDPoint {
  double x;
  double y;
  
}

To compile this class, put it in a file called TwoDPoint.java and type:

$ javac TwoDPoint.java

What does this produce?

Is this a complete program? Can you run it?


Previous | Next | Top | Cafe au Lait

Copyright 1997-2006 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified April 5, 2006