code sample icon Sample Code

In the generated Java class, after the first line:

                               
package oracle.model.freight;
                            

Delete all the generated code and replace with the following code:

                               
public enum FreightDestination {
  LOCAL(1.0),
  REGIONAL(2.0), 
  NATIONAL(3.0), 
  INTERNATIONAL(4.0);
  
  Double factor;
  
  private FreightDestination(Double factor) {
    this.factor = factor;
  }
  
  public Double factor() {
    return this.factor;
  }
}
                            

Instead of typing the sample code, you can copy the code in this window and then paste it into the source editor.

Copyright © 1997, 2009, Oracle. All rights reserved.

false ,,,,,,,,,,,,,,,