public class Main {
public static void main(String[] argv)
throws Exception {
List stuff = Arrays.asList(new String[] { "a", "b" });
List list = new ArrayList(stuff);
list = Collections.unmodifiableList(list);
try {
list.set(0, "new value");
}
catch (UnsupportedOperationException e) {
}
Set set = new HashSet(stuff);
set = Collections.unmodifiableSet(set);
Map map = new HashMap();
map = Collections.unmodifiableMap(map);
System.out.println("集合现在是只读");
}
}
以上代码运行输出结果为:
牛
使用道具 举报
要是你发点python或kali Linux的就好了
点评
使用道具 举报
我的主页原先更新过python的内容,你要是觉得有用,可以看看。
使用道具 举报
使用道具 举报