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


  • 相关阅读:
    迁移学习
    GAN
    PCA
    LSTM
    hdu 1754 I Hate It 线段树
    hdu 4292 Food 最大流
    hdu 2222 Keywords Search AC自动机
    hdu 3572 Task Schedule hdu 2883 kebab 最大流
    poj 1966 Cable TV Network 点连通度
    hdu 2236 匹配
  • 原文地址:https://www.cnblogs.com/erdanyang/p/10311239.html
Copyright © 2011-2022 走看看