Java OCA OCP Practice Question 2343

Question

Given the following definition of enum Size, select the commented line number(s) in class MyClass, where you can insert the enum definition individually.

(Choose all that apply.).


enum Size {SMALL, MEDIUM, LARGE}
class MyClass {//from   www.  j  a va 2  s. c  o m
    // line1
    void aMethod() {
        //line2
    }
    class Inner {
        //line3
    }
    static class StaticNested{
       //line4
    }
}
  • a The code at (#1)
  • b The code at (#2)
  • c The code at (#3)
  • d The code at (#4)


a, d

Note

You can't define an enum within a method or a nonstatic inner class.




PreviousNext

Related