home *** CD-ROM | disk | FTP | other *** search
/ Internet News 1999 October / INEWS_10_CD.ISO / pc / jdk / jdk1.2.2 / docs / guide / serialization / examples / nonserialsuper / ReadingMaterial.java < prev    next >
Encoding:
Java Source  |  1999-09-19  |  1.7 KB  |  57 lines

  1. /*
  2.  * @(#)ReadingMaterial.java    1.1 98/10/03        
  3.  *
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  *  
  19.  */
  20.  
  21. import java.io.*;
  22.  
  23. // The superclass DOES NOT implement serializable
  24. class ReadingMaterial  {
  25.     
  26.     /**
  27.      * We do not make these private because we need the subclass Book to be
  28.      * able to save the state of this superclass.
  29.      * Alternatively, we could make these private and create set and get
  30.      *  functions that would allow access to the Book subclass. 
  31.      * If we failed to do that with private fields, then fields would not
  32.      * be saveable!
  33.      */
  34.     protected String author;
  35.     protected String subject;
  36.     protected int yearwritten;
  37.     
  38.     // other relevant data and methods 
  39.     // .
  40.     // .
  41.     // .
  42.     
  43.     /*
  44.      * a mandatory public no-arg constructor... will be used to reconstruct
  45.      * this non-serializable class.
  46.      */
  47.     public ReadingMaterial() {}
  48.  
  49.     ReadingMaterial(String auth, String sub, int year) {
  50.     author = auth;
  51.     subject = sub;
  52.     yearwritten = year;
  53.     }
  54. }
  55.  
  56.  
  57.