最近看項目代碼裏,有一些故弄玄虛的東西在這邊跟我扯。他把一些變量值都放到了property屬性裏面。java
我寫了個demo來測試一下它的功能
測試
@Test public void testProperty(){ System.setProperty("testKey", "testValue"); String value = System.getProperty("testKey"); System.out.println("取到的值是"+value); }
乍一看好高大上的樣子,其實只不過是一個靜態變量而已。code
public stiatic String testKey = "testString";
只不過是至關於上面的一句話而已。
get