Components of Java Technology


  • Language elements
    • Class-based OOPL with inheritance
    • A class is a template that defines how an object will look and behave once instantiated

  • Sample Java Code

    public class Point {
          private float x_;
          private float y_;
    
          public Point (float xval,
                   float yval)
              { x_=xval; y_=yval; }
    
          public float distanceFrom
                      (Point refpt)
                      {
          ...
       }
    }
    

Detailed Description:

"Let's look at a little more detail. This is our first example of Java programming. Recall that Java is an object-oriented programming language, which means it has objects, classes, and inheritance. Think of a class as a template, or pattern, that defines an object. A class is like a cookie cutter, and the cookie is the object. Given a single cookie cutter (class), you can stamp out as many cookies (objects) as you want. This stamping-out operation is called instantiation."