Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package enues;
- public enum Units {
- METER('M'), KILOGRAM('K'), QTY('Q');
- private char value;
- Units(char value) {
- this.value = value;
- }
- public int getValue() {
- return value;
- }
- }
- public class Shop {
- public static void main(String[] args) {
- Units unit = Units.METER;
- String name = "Coś";
- if(unit == Units.METER) {
- System.out.println(name + " " + Character.toString((char) unit.getValue()));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement