Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
455 B
15
Indexable
Never
public enum StatusCode {

    INFORMATION_CODE(100),
    SUCESS_CODE(200),
    REDIRECTION_CODE(300),
    APPLICATION_ERROR_CODE(400),
    SERVER_ERROR_CODE(500);

    public int code;

    public int getCode() {
        return code;
    }

    StatusCode(int code) {
        code = code;
    }
}



A w innej klasie chcę 
   System.out.println(StatusCode.SUCESS_CODE.getCode());
   
   Niestety printuje mi 0.
   Dlaczego???