Defining a Class

The Procedure 

Real Lab Procedure

Declare a public class named 'Point' using the public class 'Point' statement. 

Within the class, two private instance variables, 'x' and 'y', are declared using the private access modifier. These variables are of type int and represent the coordinates of a point. 

Class Diagram 

Click on the Class diagram then the below diagram will be shown.

In the above diagram, 'Point' class is defined. 

The 'Point' class has two instance variables: 'x' and 'y'. 

 

Simulator Procedure

  • Find the Class Diagram button on the right side of the simulation.
  • Click on the Class Diagram button to view the class diagram.
  • Click on Reset button to redo the experiment.