public enum AmericanCoin extends Enum<AmericanCoin>
Enum Constant and Description |
---|
DIME
A Nickel, worth 5 cents.
|
NICKEL
A Nickel, worth 5 cents.
|
PENNY
A Penny, worth 1 cent.
|
QUARTER |
Modifier and Type | Method and Description |
---|---|
int |
getValue()
The value - in cents - of this coin.
|
static AmericanCoin |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static AmericanCoin[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final AmericanCoin PENNY
public static final AmericanCoin NICKEL
public static final AmericanCoin DIME
public static final AmericanCoin QUARTER
public static AmericanCoin[] values()
for (AmericanCoin c : AmericanCoin.values()) System.out.println(c);
public static AmericanCoin valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic int getValue()
Copyright © 2005–2017 MojoHaus. All rights reserved.