TopA Few Other Primitive TypesDefining New Classes

Defining New Classes

We developed a fancier version of Basketball where we drag around something that looked more like a real basketball.

The structure of a class is as follows:

    public class Name
    {
        constant and instance variable declarations

        constructor definition(s)
       
        method definitions
    }

When we define such a class:

Notice the difference between the move and contains method in BBall. Also notice how moveTo cleverly uses the move method of the class via writing this.move(...,...).


TopA Few Other Primitive TypesDefining New Classes