Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.EnumSet;

public class Main {

    public static void main(String[] args) {
        final EnumSet<Style> styles = EnumSet.noneOf(Style.class);
        styles.addAll(EnumSet.range(Style.BOLD, Style.STRIKETHROUGH));
        styles.removeAll(EnumSet.of(Style.UNDERLINE, Style.STRIKETHROUGH));
        assert EnumSet.of(Style.BOLD, Style.ITALIC).equals(styles);
        System.out.println(styles);
    }
}

enum Style {
    BOLD, ITALIC, UNDERLINE, STRIKETHROUGH
}