fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8.  
  9. enum ItemType {
  10. BOOTS (4),
  11. BELT(2),
  12. HELM(4),
  13. RING(1),
  14. AMULET(1),
  15. GLOVES(4),
  16. BODY_ARMOUR(6),
  17. WEAPON_2(2),
  18. //... other ones here
  19. WEAPON_8(8),
  20. SHIELD_4(4),
  21. //... other ones here
  22. SHIELD_8(8);
  23.  
  24. private int size;
  25.  
  26. ItemType(int size) {
  27. this.size = size;
  28. }
  29.  
  30. public int getSize() {
  31. return size;
  32. }
  33. }
  34. class Ideone
  35. {
  36. public static void main (String[] args) throws java.lang.Exception
  37. {
  38. System.out.println(ItemType.SHIELD_8.getSize());
  39. }
  40. }
Success #stdin #stdout 0.12s 320576KB
stdin
Standard input is empty
stdout
8