Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java enum

package vn.viettuts.javaenum;
 
public enum PageInfo {
    // define enum with 3 variable
    PAGE_001("PAGE_001", "Login", "/login"), 
    PAGE_002("PAGE_002", "Add new user", "/addUser"), 
    PAGE_003("PAGE_003", "List user", "/listUser");
     
    private String pageID;
    private String pageTitle;
    private String pageURL;
     
    /**
     * constructor
     * 
     * @param pageID
     * @param pageTitle
     * @param pageURL
     */
    private PageInfo(String pageID, String pageTitle, String pageURL) {
        this.pageID = pageID;
        this.pageTitle = pageTitle;
        this.pageURL = pageURL;
    }
     
    // getter & setter
    public String getPageID() {
        return pageID;
    }
 
    public void setPageID(String pageID) {
        this.pageID = pageID;
    }
 
    public String getPageTitle() {
        return pageTitle;
    }
 
    public void setPageTitle(String pageTitle) {
        this.pageTitle = pageTitle;
    }
 
    public String getPageURL() {
        return pageURL;
    }
 
    public void setPageURL(String pageURL) {
        this.pageURL = pageURL;
    }
}
Source by viettuts.vn #
 
PREVIOUS NEXT
Tagged: #java #enum
ADD COMMENT
Topic
Name
6+8 =