CopyConDemo.java - This program uses the Stock class's copy...

This preview shows page 1 out of 1 page.

/** This program uses the Stock class's copy constructor method to create a copy of a Stock object. */ public class CopyConDemo { public static void main(String[] args) { // Create a Stock object. Stock company1 = new Stock("XYZ", 9.62); // Create another Stock object using the // copy constructor. Stock company2 = new Stock(company1); // Display the contents of both objects. System.out.println("Company 1:\n" + company1);

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture