-5

如果我们创建一个像这样的属性:

Properties properties = new Properties();
properties.put("[%1]", "username");
properties.put("[%2]", "password");

然后添加什么作为属性中的键。

4

2 回答 2

0

java.util.Propertiesjava.util.HashTable继承put 方法,因此您的密钥将是并且在您的情况下。"[%1]""[%2]"

哈希表.put()

public V put(K key,
    V value)
于 2013-01-15T11:23:38.913 回答
0
properties.put(<key>, <value>);

这是你想知道的。

Properties是 的子类Hashtable,它表示一组持久的属性。

Properties#put方法继承自超类HashTable

于 2013-01-15T11:24:00.480 回答