问题描述
public enum Urls{http://iteye.com,http://iteye.com}像上面那样,http就成标签了,//把后面的注释掉了。要怎么样才好呢
解决方案
public class TestEnum{ public enum Urls { javaeye("http://iteye.com"), iteye("http://iteye.com"), ; private final String urlStr; Urls(String urlStr) { this.urlStr = urlStr; } public String getUrlStr() { return urlStr; } } @Test public void test() { System.out.println(Urls.iteye.getUrlStr()); }}
解决方案二:
没有这么用的,也没有必要
时间: 2024-12-21 15:41:49