码迷,mamicode.com
首页 > 编程语言 > 详细

Java常用实体类

时间:2015-06-25 01:16:32      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

System类

  访问系统属性 - 遍历

技术分享
 1 package org.zln.usefulclass.system;
 2 
 3 import java.util.Properties;
 4 
 5 /**
 6  * Created by sherry on 000024/6/24 23:08.
 7  */
 8 public class TestSystemProperty {
 9     public static void main(String[] args) {
10         //showSystemProperties();
11         /*获取某个系统属性*/
12         System.out.println(System.getProperty("java.version"));
13     }
14 
15     /**
16      * 遍历系统所有属性
17      */
18     private static void showSystemProperties() {
19         Properties properties = System.getProperties();
20         properties.list(System.out);
21     }
22 }
D:\GitHub\tools\JavaEEDevelop\Lesson1_JavaSe_Demo1\src\org\zln\usefulclass\system\TestSystemProperty.java

 

  遍历环境变量

技术分享
 1     /**
 2      * 遍历环境变量
 3      */
 4     public static void showEnvProperties(){
 5         Map<String,String> map = System.getenv();
 6         Iterator<String> iterator = map.keySet().iterator();
 7         while (iterator.hasNext()){
 8             String k = iterator.next();
 9             String v = map.get(k);
10             System.out.println(k+":"+v);
11         }
12     }
遍历环境变量

 

Java常用实体类

标签:

原文地址:http://www.cnblogs.com/sherrykid/p/4598962.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!