一、系统属性的获取:
package org.eclipse.winery.repository;
import java.util.Properties;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Properties properties = System.getProperties();
String str = properties.toString();
String[] strplits = str.split(",");
for (String i : strplits) {
System.out.println(i);
}
System.out.println(System.getProperty("user.dir"));
}
}
二、本地属性的获取Properties:
package org.eclipse.winery.repository;
import java.util.Properties;
public class Main {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
Properties properties = new Properties();
properties.load(Main.class.getResourceAsStream("/config.properties"));
System.out.println(properties.toString());
}
}
二、获取本地ip
String ip = Inet4Address.getLocalHost().getHostAddress();
三、java的类与对象的从属关系的判断:
1、isAssignableFrom class1.isAssignableFrom(class2)
class1是class2的父类或者接口返回true
class1和class2是同一个接口或者类返回true
2、instance of (obj instance of class)
![](https://img2018.cnblogs.com/blog/969866/201901/969866-20190124181257062-1109990324.png)
3、isInstance (class.isInstance(obj))
![](https://img2018.cnblogs.com/blog/969866/201901/969866-20190124181630874-1241345014.png)
四、URL与URI