活动图
大约 3 分钟
username.github.io
2. 创建 index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>我的网站</title>
</head>
<body>
<h1>我的网站</h1>
<p>我的网站。</p>
</body>
</html>
default 关键字default 关键字是 Java 8 中引入的一个新特性,它允许我们为接口中的方法提供一个默认实现。
如 Java HashMap 接口中的 putIfAbsent 方法就是通过 default 关键字来定义的
public interface Map<K,V> {
// ... 省略其他方法
default V putIfAbsent(K key, V value) {
V v = get(key);
if (v == null) {
v = put(key, value);
}
return v;
}
// ... 省略其他方法
}