Given:
class Shape { int getArea() { return 24;/* ww w. j ava 2 s . c o m*/ } } public class Main extends Shape { enum Letter { A, B, C }; public static void main(String[] args) { Letter v = Letter.B; switch (v) { case A: System.out.print("12 "); default: System.out.print(getArea() + " "); case C: System.out.print("110 "); } } }
What is the result? (Choose all that apply.)
E is correct.
The code fails because the instance method getArea()
is called from a static method.
The enums are used correctly.
If getArea()
was a static method, the output would be "24 110".