package org.djunits.demo.examples; import org.djunits.unit.LengthUnit; import org.djunits.value.vdouble.scalar.Length; /** *

* Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License. *

* @author Alexander Verbraeck * @author Peter Knoppers * @author Wouter Schakel */ public final class ShowDisplayUnit { /** */ private ShowDisplayUnit() { // Utility class } /** * @param args String[]; args (blank) */ public static void main(final String[] args) { Length length = new Length(10.00, LengthUnit.KILOMETER); System.out.println("original len: " + length); System.out.println("original si : " + length.si); length.setDisplayUnit(LengthUnit.METER); System.out.println("changed len: " + length); System.out.println("[not] changed si : " + length.si); // not possible: length.setDisplayUnit(MassUnit.KILOGRAM); } }