0
why does this refer to small
enum Size{ SMALL, MEDIUM, LARGE, EXTRALARGE; public String getSize() { // this will refer to the object SMALL switch(this) { case SMALL: return "small"; case MEDIUM: return "medium"; case LARGE: return "large"; case EXTRALARGE: return "extra large"; default: return null; } } public static void main(String[] args) { // call getSize() // using the object SMALL System.out.println("The size of the pizza is " + Size.SMALL.getSize()); } }
1 Antwort
0
Well I see you getting the Size of the Small enum collection