Skip to content

Commit 9446da7

Browse files
add system property demo
1 parent 8c1e6f4 commit 9446da7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package ABasic.A9System;
2+
3+
public class SystemDemo {
4+
5+
static{
6+
//设置system property方式1:通过System.setProperty()方法
7+
//方式2为设置VM arguments
8+
//可以作为全局变量,在任何地方使用
9+
System.setProperty("DB", "mysql");
10+
}
11+
public static void main(String[] args) {
12+
System.out.println(System.getProperty("os.version"));
13+
System.out.println(System.getProperty("java.library.path"));
14+
System.out.println(System.getProperty("isP268"));
15+
}
16+
17+
}

0 commit comments

Comments
 (0)