6.5. Class Line Maintains a Line’s Endpoints

This app consists of four classes:

Line (Fig. 6.4)

 1   // Line.java 2   // Class Line represents a line with two endpoints. 3   package com.deitel.cannongame; 4  5   import android.graphics.Point; 6  7   public class Line 8   { 9      public Point start = new Point(); // start Point--(0,0) by default10      public Point end = new Point(); // end Point--(0,0) by default    11   } // end class Line

Fig. 6.4 | Class Line represents a line with two endpoints.

MainActivity (the Activity subclass; Section 6.6)

CannonGameFragment (Section 6.7), and

CannonView (Section 6.8)

In this section, we discuss class Line, which represents a line’s starting and ending Point ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.