java - Syntax error, insert "EnumBody" to complete EnumDeclaration melwin -


i error in line. please me this.

public enum **status**     {      class_not_found_exception = new status("class_not_found_exception", 2);      illegal_access_exception = new status("illegal_access_exception", 3);       instantiation_exception = new status("instantiation_exception", 4);       malformed_url_exception = new status("malformed_url_exception", 5);       io_exception = new status("io_exception", 6);       invalid_action = new status("invalid_action", 7);       json_exception = new status("json_exception", 8);       error = new status("error", 9);      status[] arrayofstatus = new status[10];   arrayofstatus[0] = no_result;   arrayofstatus[1] = ok;   arrayofstatus[2] = class_not_found_exception;   arrayofstatus[3] = illegal_access_exception;   arrayofstatus[4] = instantiation_exception;   arrayofstatus[5] = malformed_url_exception;   arrayofstatus[6] = io_exception;   arrayofstatus[7] = invalid_action;   arrayofstatus[8] = json_exception;   arrayofstatus[9] = error;   $values = arrayofstatus;   } 

as know, enum in java implemented class list of predefined values, may (and must in case) contain fields , constructors (and methods, of course).

so here similar attempt , valid java enum

enum status {      class_not_found_exception("class_not_found_exception", 2),     illegal_access_exception("illegal_access_exception", 3),     instantiation_exception("instantiation_exception", 4),     malformed_url_exception("malformed_url_exception", 5),     io_exception("io_exception", 6),     invalid_action("invalid_action", 7),     json_exception("json_exception", 8),     error("error", 9);      private string title;     private int number;      private status(string title, int number) {         this.title = title;         this.number = number;     }      // getters } 

after definition can create array of enum values if need it.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -