zoukankan      html  css  js  c++  java
  • JAVA原生

    一、系统属性的获取:

    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)

    3、isInstance (class.isInstance(obj))

    四、URL与URI


  • 相关阅读:
    luogu 3388 【模板】割点(割顶)
    bzoj 3624 免费道路
    bzoj 1179 Atm
    bzoj 2428 均分数据
    luogu 4429 染色
    luogu 4427 求和
    luogu 1121 环状最大两段子段和
    hdu 4777 Queue
    hdu 5492 Find a path
    hdu 5441 Travel
  • 原文地址:https://www.cnblogs.com/erdanyang/p/10311239.html
Copyright © 2011-2022 走看看