0

Good night guys,

I wanted to ask, why it's not possible, to print out the content of an enumeration without a for loop.

For example this:

public class NurTests {

    enum optionen{
       Option1, Option2, Option3;
    }

  public static void main(String[] args) {

    for (optionen d: optionen.values()){
        System.out.println(d);
    }
  }
}

Why can't I write this? Or why can't I write System.out.println(optionen) either?

System.out.println(optionen.values());

Thanks in advance.

NewbieJava
  • 117
  • 11

0 Answers0